mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-30 12:54:31 +01:00
implement notifications service
This commit is contained in:
parent
1bf9f76e39
commit
38371d2dec
2
jslib
2
jslib
@ -1 +1 @@
|
|||||||
Subproject commit aed1c5e92762f1d2fa037aa9eb4d2b8e82f45707
|
Subproject commit 9bd8b73e27429b70a11e0016f794d1a976076c9f
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -102,6 +102,11 @@
|
|||||||
"tslib": "^1.7.1"
|
"tslib": "^1.7.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@aspnet/signalr": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@aspnet/signalr/-/signalr-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-sXleqUCCbodCOqUA8MjLSvtAgDTvDhEq6j3JyAq/w4RMJhpZ+dXK9+6xEMbzag2hisq5e/8vDC82JYutkcOISQ=="
|
||||||
|
},
|
||||||
"@ngtools/webpack": {
|
"@ngtools/webpack": {
|
||||||
"version": "1.10.2",
|
"version": "1.10.2",
|
||||||
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-1.10.2.tgz",
|
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-1.10.2.tgz",
|
||||||
|
@ -238,6 +238,7 @@
|
|||||||
"@angular/platform-browser-dynamic": "5.2.0",
|
"@angular/platform-browser-dynamic": "5.2.0",
|
||||||
"@angular/router": "5.2.0",
|
"@angular/router": "5.2.0",
|
||||||
"@angular/upgrade": "5.2.0",
|
"@angular/upgrade": "5.2.0",
|
||||||
|
"@aspnet/signalr": "1.0.2",
|
||||||
"angular2-toaster": "4.0.2",
|
"angular2-toaster": "4.0.2",
|
||||||
"angulartics2": "5.0.1",
|
"angulartics2": "5.0.1",
|
||||||
"core-js": "2.4.1",
|
"core-js": "2.4.1",
|
||||||
|
@ -38,6 +38,11 @@
|
|||||||
<label for="identityUrl">{{'identityUrl' | i18n}}</label>
|
<label for="identityUrl">{{'identityUrl' | i18n}}</label>
|
||||||
<input id="identityUrl" type="text" name="IdentityUrl" [(ngModel)]="identityUrl">
|
<input id="identityUrl" type="text" name="IdentityUrl" [(ngModel)]="identityUrl">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="box-content-row" appBoxRow>
|
||||||
|
<label for="notificationsUrl">{{'notificationsUrl' | i18n}}</label>
|
||||||
|
<input id="notificationsUrl" type="text" name="NotificationsUrl"
|
||||||
|
[(ngModel)]="notificationsUrl">
|
||||||
|
</div>
|
||||||
<div class="box-content-row" appBoxRow>
|
<div class="box-content-row" appBoxRow>
|
||||||
<label for="iconsUrl">{{'iconsUrl' | i18n}}</label>
|
<label for="iconsUrl">{{'iconsUrl' | i18n}}</label>
|
||||||
<input id="iconsUrl" type="text" name="IconsUrl" [(ngModel)]="iconsUrl">
|
<input id="iconsUrl" type="text" name="IconsUrl" [(ngModel)]="iconsUrl">
|
||||||
|
@ -31,6 +31,7 @@ import { FolderService } from 'jslib/abstractions/folder.service';
|
|||||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
import { LockService } from 'jslib/abstractions/lock.service';
|
import { LockService } from 'jslib/abstractions/lock.service';
|
||||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||||
|
import { NotificationsService } from 'jslib/abstractions/notifications.service';
|
||||||
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
||||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
import { SearchService } from 'jslib/abstractions/search.service';
|
import { SearchService } from 'jslib/abstractions/search.service';
|
||||||
@ -80,7 +81,7 @@ export class AppComponent implements OnInit {
|
|||||||
private lockService: LockService, private storageService: StorageService,
|
private lockService: LockService, private storageService: StorageService,
|
||||||
private cryptoService: CryptoService, private componentFactoryResolver: ComponentFactoryResolver,
|
private cryptoService: CryptoService, private componentFactoryResolver: ComponentFactoryResolver,
|
||||||
private messagingService: MessagingService, private collectionService: CollectionService,
|
private messagingService: MessagingService, private collectionService: CollectionService,
|
||||||
private searchService: SearchService) {
|
private searchService: SearchService, private notificationsService: NotificationsService) {
|
||||||
(window as any).BitwardenToasterService = toasterService;
|
(window as any).BitwardenToasterService = toasterService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +103,11 @@ export class AppComponent implements OnInit {
|
|||||||
this.ngZone.run(async () => {
|
this.ngZone.run(async () => {
|
||||||
switch (message.command) {
|
switch (message.command) {
|
||||||
case 'loggedIn':
|
case 'loggedIn':
|
||||||
case 'unlocked':
|
|
||||||
case 'loggedOut':
|
case 'loggedOut':
|
||||||
|
this.notificationsService.updateConnection();
|
||||||
|
this.updateAppMenu();
|
||||||
|
break;
|
||||||
|
case 'unlocked':
|
||||||
this.updateAppMenu();
|
this.updateAppMenu();
|
||||||
break;
|
break;
|
||||||
case 'logout':
|
case 'logout':
|
||||||
|
@ -36,6 +36,7 @@ import { ExportService } from 'jslib/services/export.service';
|
|||||||
import { FolderService } from 'jslib/services/folder.service';
|
import { FolderService } from 'jslib/services/folder.service';
|
||||||
import { LockService } from 'jslib/services/lock.service';
|
import { LockService } from 'jslib/services/lock.service';
|
||||||
import { LowdbStorageService } from 'jslib/services/lowdbStorage.service';
|
import { LowdbStorageService } from 'jslib/services/lowdbStorage.service';
|
||||||
|
import { NotificationsService } from 'jslib/services/notifications.service';
|
||||||
import { PasswordGenerationService } from 'jslib/services/passwordGeneration.service';
|
import { PasswordGenerationService } from 'jslib/services/passwordGeneration.service';
|
||||||
import { SearchService } from 'jslib/services/search.service';
|
import { SearchService } from 'jslib/services/search.service';
|
||||||
import { SettingsService } from 'jslib/services/settings.service';
|
import { SettingsService } from 'jslib/services/settings.service';
|
||||||
@ -61,6 +62,7 @@ import { I18nService as I18nServiceAbstraction } from 'jslib/abstractions/i18n.s
|
|||||||
import { LockService as LockServiceAbstraction } from 'jslib/abstractions/lock.service';
|
import { LockService as LockServiceAbstraction } from 'jslib/abstractions/lock.service';
|
||||||
import { LogService as LogServiceAbstraction } from 'jslib/abstractions/log.service';
|
import { LogService as LogServiceAbstraction } from 'jslib/abstractions/log.service';
|
||||||
import { MessagingService as MessagingServiceAbstraction } from 'jslib/abstractions/messaging.service';
|
import { MessagingService as MessagingServiceAbstraction } from 'jslib/abstractions/messaging.service';
|
||||||
|
import { NotificationsService as NotificationsServiceAbstraction } from 'jslib/abstractions/notifications.service';
|
||||||
import {
|
import {
|
||||||
PasswordGenerationService as PasswordGenerationServiceAbstraction,
|
PasswordGenerationService as PasswordGenerationServiceAbstraction,
|
||||||
} from 'jslib/abstractions/passwordGeneration.service';
|
} from 'jslib/abstractions/passwordGeneration.service';
|
||||||
@ -111,19 +113,20 @@ const authService = new AuthService(cryptoService, apiService,
|
|||||||
userService, tokenService, appIdService, i18nService, platformUtilsService, messagingService);
|
userService, tokenService, appIdService, i18nService, platformUtilsService, messagingService);
|
||||||
const exportService = new ExportService(folderService, cipherService, apiService);
|
const exportService = new ExportService(folderService, cipherService, apiService);
|
||||||
const auditService = new AuditService(cryptoFunctionService, apiService);
|
const auditService = new AuditService(cryptoFunctionService, apiService);
|
||||||
|
const notificationsService = new NotificationsService(userService, tokenService, syncService, appIdService);
|
||||||
|
|
||||||
const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService);
|
const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService);
|
||||||
containerService.attachToWindow(window);
|
containerService.attachToWindow(window);
|
||||||
environmentService.setUrlsFromStorage().then(() => {
|
|
||||||
return syncService.fullSync(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
export function initFactory(): Function {
|
export function initFactory(): Function {
|
||||||
return async () => {
|
return async () => {
|
||||||
|
await environmentService.setUrlsFromStorage();
|
||||||
|
syncService.fullSync(true);
|
||||||
lockService.init(true);
|
lockService.init(true);
|
||||||
const locale = await storageService.get<string>(ConstantsService.localeKey);
|
const locale = await storageService.get<string>(ConstantsService.localeKey);
|
||||||
await i18nService.init(locale);
|
await i18nService.init(locale);
|
||||||
await authService.init();
|
await authService.init();
|
||||||
|
setTimeout(() => notificationsService.init(environmentService), 3000);
|
||||||
const htmlEl = window.document.documentElement;
|
const htmlEl = window.document.documentElement;
|
||||||
htmlEl.classList.add('os_' + platformUtilsService.getDeviceString());
|
htmlEl.classList.add('os_' + platformUtilsService.getDeviceString());
|
||||||
htmlEl.classList.add('locale_' + i18nService.translationLocale);
|
htmlEl.classList.add('locale_' + i18nService.translationLocale);
|
||||||
@ -186,6 +189,7 @@ export function initFactory(): Function {
|
|||||||
{ provide: LogServiceAbstraction, useValue: logService },
|
{ provide: LogServiceAbstraction, useValue: logService },
|
||||||
{ provide: ExportServiceAbstraction, useValue: exportService },
|
{ provide: ExportServiceAbstraction, useValue: exportService },
|
||||||
{ provide: SearchServiceAbstraction, useValue: searchService },
|
{ provide: SearchServiceAbstraction, useValue: searchService },
|
||||||
|
{ provide: NotificationsServiceAbstraction, useValue: notificationsService },
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: initFactory,
|
useFactory: initFactory,
|
||||||
|
@ -593,6 +593,9 @@
|
|||||||
"identityUrl": {
|
"identityUrl": {
|
||||||
"message": "Identity Server URL"
|
"message": "Identity Server URL"
|
||||||
},
|
},
|
||||||
|
"notificationsUrl": {
|
||||||
|
"message": "Notifications Server URL"
|
||||||
|
},
|
||||||
"iconsUrl": {
|
"iconsUrl": {
|
||||||
"message": "Icons Server URL"
|
"message": "Icons Server URL"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user