]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts
Remove useless async
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-watch / shared / information / privacy-concerns.component.ts
1 import { Component, OnInit } from '@angular/core'
2 import { ServerService } from '@app/core'
3 import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
4 import { HTMLServerConfig } from '@shared/models'
5 import { getStoredP2PEnabled } from '../../../../../assets/player/peertube-player-local-storage'
6 import { isWebRTCDisabled } from '../../../../../assets/player/utils'
7
8 @Component({
9 selector: 'my-privacy-concerns',
10 templateUrl: './privacy-concerns.component.html',
11 styleUrls: [ './privacy-concerns.component.scss' ]
12 })
13 export class PrivacyConcernsComponent implements OnInit {
14 private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern'
15
16 hasAlreadyAcceptedPrivacyConcern = false
17
18 private serverConfig: HTMLServerConfig
19
20 constructor (
21 private serverService: ServerService
22 ) { }
23
24 ngOnInit () {
25 this.serverConfig = this.serverService.getHTMLConfig()
26
27 if (
28 isWebRTCDisabled() ||
29 this.serverConfig.tracker.enabled === false ||
30 getStoredP2PEnabled() === false ||
31 peertubeLocalStorage.getItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
32 ) {
33 this.hasAlreadyAcceptedPrivacyConcern = true
34 }
35 }
36
37 declinedPrivacyConcern () {
38 peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'false')
39 this.hasAlreadyAcceptedPrivacyConcern = false
40 }
41
42 acceptedPrivacyConcern () {
43 peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
44 this.hasAlreadyAcceptedPrivacyConcern = true
45 }
46 }