From 74c2dece42d387506421623fbfadc83da811ebcd Mon Sep 17 00:00:00 2001 From: Kim <1877318+kimsible@users.noreply.github.com> Date: Wed, 15 Apr 2020 09:08:59 +0200 Subject: Add notifier to plugin helpers (#2627) * Add notifier to client PeerTubeHelpers plugin * Add doc for notifier PeerTubeHelpers * Add getBaseClientScriptsRoute to client PeerTubeHelpers plugin * Add doc for getBaseClientScriptsRoute PeerTubeHelpers * Remove unused helper Co-authored-by: kimsible --- client/src/app/core/plugins/plugin.service.ts | 5 ++++- client/src/types/register-client-option.model.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'client/src') diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index da5114048..b9d55a7e4 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts @@ -12,7 +12,7 @@ import { ClientHook, ClientHookName, clientHookObject } from '@shared/models/plu import { PluginClientScope } from '@shared/models/plugins/plugin-client-scope.type' import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' import { HttpClient } from '@angular/common/http' -import { AuthService } from '@app/core/auth' +import { AuthService, Notifier } from '@app/core' import { RestExtractor } from '@app/shared/rest' import { PluginType } from '@shared/models/plugins/plugin.type' import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' @@ -60,6 +60,7 @@ export class PluginService implements ClientHook { constructor ( private router: Router, private authService: AuthService, + private notifier: Notifier, private server: ServerService, private zone: NgZone, private authHttp: HttpClient, @@ -272,6 +273,8 @@ export class PluginService implements ClientHook { return this.authService.isLoggedIn() }, + notifier: this.notifier, + translate: (value: string) => { return this.translationsObservable .pipe(map(allTranslations => allTranslations[npmName])) diff --git a/client/src/types/register-client-option.model.ts b/client/src/types/register-client-option.model.ts index 638b08653..1faf13c42 100644 --- a/client/src/types/register-client-option.model.ts +++ b/client/src/types/register-client-option.model.ts @@ -1,4 +1,5 @@ import { RegisterClientHookOptions } from '@shared/models/plugins/register-client-hook.model' +import { Notifier } from '@app/core' export type RegisterClientOptions = { registerHook: (options: RegisterClientHookOptions) => void @@ -13,5 +14,7 @@ export type RegisterClientHelpers = { getSettings: () => Promise<{ [ name: string ]: string }> + notifier: Notifier + translate: (toTranslate: string) => Promise } -- cgit v1.2.3