-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds warning in browsers without File System Access API
In case any user logs in to the VSCode4Teaching web application in a browser that does not support the File System Access API (such as, for example, Firefox currently), a warning will be displayed recommending to change browser, as most of the functionality of this application will be inoperative.
- Loading branch information
1 parent
88057d3
commit 1226255
Showing
15 changed files
with
100 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
.../not-supported-file-system-access-api/not-supported-file-system-access-api.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="container justify-content-center" *ngIf="this.showFsaAPINotSupportedMessage"> | ||
<div class="row"> | ||
<div class="col mt-1 mb-3"> | ||
<div class="alert alert-v4t text-center"> | ||
<i class="fa fa-exclamation-circle"></i> <strong>Attention!</strong> This web browser does not support interaction with your computer files and folders, so you will not be able to use features like exercise download or automatic file synchronization. | ||
<br>If you want to use these features, please use a compatible browser like most recent versions of Google Chrome or Microsoft Edge. Check out compatibility in <a href="https://caniuse.com/native-filesystem-api" target="_blank" class="link-v4t link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">this link</a>. | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
Empty file.
21 changes: 21 additions & 0 deletions
21
...t-supported-file-system-access-api/not-supported-file-system-access-api.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { NotSupportedFileSystemAccessApiComponent } from './not-supported-file-system-access-api.component'; | ||
|
||
describe('NotSupportedFileSystemAccessApiComponent', () => { | ||
let component: NotSupportedFileSystemAccessApiComponent; | ||
let fixture: ComponentFixture<NotSupportedFileSystemAccessApiComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [NotSupportedFileSystemAccessApiComponent] | ||
}); | ||
fixture = TestBed.createComponent(NotSupportedFileSystemAccessApiComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
...rs/not-supported-file-system-access-api/not-supported-file-system-access-api.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { Event, NavigationStart, Router } from "@angular/router"; | ||
import { supported as fileSystemAccessApiSupported } from "browser-fs-access"; | ||
import { Subscription } from "rxjs"; | ||
import { CurrentUserService } from "../../../services/auth/current-user/current-user.service"; | ||
|
||
@Component({ | ||
selector: 'app-not-supported-file-system-access-api', | ||
templateUrl: './not-supported-file-system-access-api.component.html', | ||
styleUrls: ['./not-supported-file-system-access-api.component.scss'] | ||
}) | ||
export class NotSupportedFileSystemAccessApiComponent implements OnInit, OnDestroy { | ||
public showFsaAPINotSupportedMessage: boolean; | ||
public routerSubscription?: Subscription; | ||
|
||
constructor(private curUser: CurrentUserService, private router: Router) { | ||
this.showFsaAPINotSupportedMessage = false; | ||
} | ||
|
||
async ngOnInit(): Promise<void> { | ||
this.routerSubscription = this.router.events.subscribe({ | ||
next: async (event: Event) => { | ||
if (event instanceof NavigationStart) { | ||
this.showFsaAPINotSupportedMessage = !fileSystemAccessApiSupported && (await this.curUser.currentUser) !== undefined | ||
} | ||
} | ||
}); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.routerSubscription?.unsubscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters