import { concat, forkJoin, merge } from 'rxjs'
import { Component, Input, OnChanges, OnInit } from '@angular/core'
-import { Router } from '@angular/router'
-import { AuthService, Notifier } from '@app/core'
+import { AuthService, Notifier, RedirectService } from '@app/core'
import { Account, VideoChannel, VideoService } from '@app/shared/shared-main'
import { FeedFormat } from '@shared/models'
import { UserSubscriptionService } from './user-subscription.service'
constructor (
private authService: AuthService,
- private router: Router,
+ private redirectService: RedirectService,
private notifier: Notifier,
private userSubscriptionService: UserSubscriptionService,
private videoService: VideoService
this.notifier.success(
this.account
? $localize`Unsubscribed from all channels of ${this.account.nameWithHost}`
- : $localize`Unsubscribed from ${this.videoChannels[ 0 ].nameWithHost}`,
+ : $localize`Unsubscribed from ${this.videoChannels[0].nameWithHost}`,
$localize`Unsubscribed`
)
}
gotoLogin () {
- this.router.navigate([ '/login' ])
+ this.redirectService.redirectToLogin()
}
subscribeStatus (subscribed: boolean) {
const accumulator: string[] = []
- for (const [key, value] of this.subscribed.entries()) {
+ for (const [ key, value ] of this.subscribed.entries()) {
if (value === subscribed) accumulator.push(key)
}
return Array.from(this.subscribed.values()).every(v => v === true)
}
+ isRemoteSubscribeAvailable () {
+ return !this.isUserLoggedIn()
+ }
+
private getChannelHandler (videoChannel: VideoChannel) {
return videoChannel.name + '@' + videoChannel.host
}