implement notifications service
This commit is contained in:
parent
ce61e62cf0
commit
50c94f587d
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit b64757132faf1ebb5438bec00720c58604fd29f6
|
||||
Subproject commit 21e09535896078c4716205e8141f6d3b2182a981
|
|
@ -96,6 +96,11 @@
|
|||
"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": {
|
||||
"version": "1.10.2",
|
||||
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-1.10.2.tgz",
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
"@angular/platform-browser-dynamic": "5.2.0",
|
||||
"@angular/router": "5.2.0",
|
||||
"@angular/upgrade": "5.2.0",
|
||||
"@aspnet/signalr": "1.0.2",
|
||||
"angular2-toaster": "4.0.2",
|
||||
"angulartics2": "5.0.1",
|
||||
"core-js": "2.4.1",
|
||||
|
|
|
@ -767,6 +767,9 @@
|
|||
"identityUrl": {
|
||||
"message": "Identity Server URL"
|
||||
},
|
||||
"notificationsUrl": {
|
||||
"message": "Notifications Server URL"
|
||||
},
|
||||
"iconsUrl": {
|
||||
"message": "Icons Server URL"
|
||||
},
|
||||
|
|
|
@ -20,6 +20,7 @@ import {
|
|||
UserService,
|
||||
} from 'jslib/services';
|
||||
import { ExportService } from 'jslib/services/export.service';
|
||||
import { NotificationsService } from 'jslib/services/notifications.service';
|
||||
import { SearchService } from 'jslib/services/search.service';
|
||||
import { WebCryptoFunctionService } from 'jslib/services/webCryptoFunction.service';
|
||||
|
||||
|
@ -45,6 +46,7 @@ import {
|
|||
UserService as UserServiceAbstraction,
|
||||
} from 'jslib/abstractions';
|
||||
import { ExportService as ExportServiceAbstraction } from 'jslib/abstractions/export.service';
|
||||
import { NotificationsService as NotificationsServiceAbstraction } from 'jslib/abstractions/notifications.service';
|
||||
import { SearchService as SearchServiceAbstraction } from 'jslib/abstractions/search.service';
|
||||
|
||||
import { Analytics } from 'jslib/misc';
|
||||
|
@ -93,6 +95,7 @@ export default class MainBackground {
|
|||
auditService: AuditServiceAbstraction;
|
||||
exportService: ExportServiceAbstraction;
|
||||
searchService: SearchServiceAbstraction;
|
||||
notificationsService: NotificationsServiceAbstraction;
|
||||
analytics: Analytics;
|
||||
|
||||
onUpdatedRan: boolean;
|
||||
|
@ -128,7 +131,6 @@ export default class MainBackground {
|
|||
this.appIdService = new AppIdService(this.storageService);
|
||||
this.apiService = new ApiService(this.tokenService, this.platformUtilsService,
|
||||
async (expired: boolean) => await this.logout(expired));
|
||||
this.environmentService = new EnvironmentService(this.apiService, this.storageService);
|
||||
this.userService = new UserService(this.tokenService, this.storageService);
|
||||
this.settingsService = new SettingsService(this.userService, this.storageService);
|
||||
this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService,
|
||||
|
@ -155,6 +157,10 @@ export default class MainBackground {
|
|||
this.containerService = new ContainerService(this.cryptoService, this.platformUtilsService);
|
||||
this.auditService = new AuditService(cryptoFunctionService, this.apiService);
|
||||
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService);
|
||||
this.notificationsService = new NotificationsService(this.userService, this.tokenService,
|
||||
this.syncService, this.appIdService);
|
||||
this.environmentService = new EnvironmentService(this.apiService, this.storageService,
|
||||
this.notificationsService);
|
||||
this.analytics = new Analytics(window, () => BrowserApi.gaFilter(), this.platformUtilsService,
|
||||
this.storageService, this.appIdService);
|
||||
|
||||
|
@ -166,7 +172,7 @@ export default class MainBackground {
|
|||
// Background
|
||||
this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.cipherService,
|
||||
this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService,
|
||||
this.analytics);
|
||||
this.analytics, this.notificationsService);
|
||||
this.tabsBackground = new TabsBackground(this, this.platformUtilsService);
|
||||
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService,
|
||||
this.platformUtilsService, this.analytics);
|
||||
|
@ -202,7 +208,8 @@ export default class MainBackground {
|
|||
await this.environmentService.setUrlsFromStorage();
|
||||
await this.setIcon();
|
||||
this.cleanupNotificationQueue();
|
||||
await this.fullSync(true);
|
||||
this.fullSync(true);
|
||||
setTimeout(() => this.notificationsService.init(this.environmentService), 2500);
|
||||
resolve();
|
||||
}, 500);
|
||||
});
|
||||
|
@ -271,6 +278,7 @@ export default class MainBackground {
|
|||
|
||||
await this.setIcon();
|
||||
await this.refreshBadgeAndMenu();
|
||||
this.notificationsService.updateConnection();
|
||||
}
|
||||
|
||||
collectPageDetailsForContentScript(tab: any, sender: string, frameId: number = null) {
|
||||
|
|
|
@ -22,6 +22,8 @@ import MainBackground from './main.background';
|
|||
import { AutofillService } from '../services/abstractions/autofill.service';
|
||||
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
|
||||
|
||||
import { NotificationsService } from 'jslib/abstractions/notifications.service';
|
||||
|
||||
import { Utils } from 'jslib/misc/utils';
|
||||
|
||||
export default class RuntimeBackground {
|
||||
|
@ -33,7 +35,8 @@ export default class RuntimeBackground {
|
|||
|
||||
constructor(private main: MainBackground, private autofillService: AutofillService,
|
||||
private cipherService: CipherService, private platformUtilsService: BrowserPlatformUtilsService,
|
||||
private storageService: StorageService, private i18nService: I18nService, private analytics: Analytics) {
|
||||
private storageService: StorageService, private i18nService: I18nService,
|
||||
private analytics: Analytics, private notificationsService: NotificationsService) {
|
||||
this.isSafari = this.platformUtilsService.isSafari();
|
||||
this.runtime = this.isSafari ? safari.application : chrome.runtime;
|
||||
|
||||
|
@ -77,6 +80,10 @@ export default class RuntimeBackground {
|
|||
async processMessage(msg: any, sender: any, sendResponse: any) {
|
||||
switch (msg.command) {
|
||||
case 'loggedIn':
|
||||
await this.main.setIcon();
|
||||
await this.main.refreshBadgeAndMenu(false);
|
||||
this.notificationsService.updateConnection();
|
||||
break;
|
||||
case 'unlocked':
|
||||
case 'locked':
|
||||
await this.main.setIcon();
|
||||
|
|
|
@ -48,6 +48,11 @@
|
|||
<input id="identityUrl" type="text" name="IdentityUrl" [(ngModel)]="identityUrl" inputmode="url"
|
||||
appInputVerbatim>
|
||||
</div>
|
||||
<div class="box-content-row" appBoxRow>
|
||||
<label for="notificationsUrl">{{'notificationsUrl' | i18n}}</label>
|
||||
<input id="notificationsUrl" type="text" name="NotificationsUrl" inputmode="url"
|
||||
[(ngModel)]="notificationsUrl" appInputVerbatim>
|
||||
</div>
|
||||
<div class="box-content-row" appBoxRow>
|
||||
<label for="iconsUrl">{{'iconsUrl' | i18n}}</label>
|
||||
<input id="iconsUrl" type="text" name="IconsUrl" [(ngModel)]="iconsUrl" inputmode="url"
|
||||
|
|
|
@ -27,6 +27,7 @@ import { FolderService } from 'jslib/abstractions/folder.service';
|
|||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { LockService } from 'jslib/abstractions/lock.service';
|
||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||
import { NotificationsService } from 'jslib/abstractions/notifications.service';
|
||||
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { SearchService as SearchServiceAbstraction } from 'jslib/abstractions/search.service';
|
||||
|
@ -146,6 +147,11 @@ export function initFactory(i18nService: I18nService, storageService: StorageSer
|
|||
{ provide: AppIdService, useFactory: getBgService<AppIdService>('appIdService'), deps: [] },
|
||||
{ provide: AutofillService, useFactory: getBgService<AutofillService>('autofillService'), deps: [] },
|
||||
{ provide: ExportService, useFactory: getBgService<ExportService>('exportService'), deps: [] },
|
||||
{
|
||||
provide: NotificationsService,
|
||||
useFactory: getBgService<NotificationsService>('notificationsService'),
|
||||
deps: [],
|
||||
},
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: initFactory,
|
||||
|
|
|
@ -121,9 +121,11 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||
this.ngZone.run(async () => {
|
||||
switch (message.command) {
|
||||
case 'syncCompleted':
|
||||
if (message.successfully) {
|
||||
window.setTimeout(() => {
|
||||
this.refresh();
|
||||
}, 500);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -94,9 +94,11 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
|||
this.ngZone.run(async () => {
|
||||
switch (message.command) {
|
||||
case 'syncCompleted':
|
||||
if (message.successfully) {
|
||||
window.setTimeout(() => {
|
||||
this.load();
|
||||
}, 500);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -268,7 +268,7 @@
|
|||
<div *ngIf="cipher.hasPasswordHistory">
|
||||
<b class="font-weight-semibold">{{'passwordHistory' | i18n}}:</b>
|
||||
<a routerLink="/cipher-password-history" [queryParams]="{cipherId: cipher.id}"
|
||||
appStopClick title="{{'passwordHistory' | i18n}}" class="text-muted">
|
||||
appStopClick title="{{'passwordHistory' | i18n}}">
|
||||
{{cipher.passwordHistory.length}}
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { Location } from '@angular/common';
|
||||
import {
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
OnInit,
|
||||
NgZone,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
|
@ -11,8 +12,6 @@ import {
|
|||
import { ToasterService } from 'angular2-toaster';
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
|
||||
import { BrowserApi } from '../../browser/browserApi';
|
||||
|
||||
import { AuditService } from 'jslib/abstractions/audit.service';
|
||||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||
|
@ -21,13 +20,15 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
|||
import { TokenService } from 'jslib/abstractions/token.service';
|
||||
import { TotpService } from 'jslib/abstractions/totp.service';
|
||||
|
||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
|
||||
import { ViewComponent as BaseViewComponent } from 'jslib/angular/components/view.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-vault-view',
|
||||
templateUrl: 'view.component.html',
|
||||
})
|
||||
export class ViewComponent extends BaseViewComponent implements OnInit {
|
||||
export class ViewComponent extends BaseViewComponent {
|
||||
showAttachments = true;
|
||||
|
||||
constructor(cipherService: CipherService, totpService: TotpService,
|
||||
|
@ -35,9 +36,11 @@ export class ViewComponent extends BaseViewComponent implements OnInit {
|
|||
cryptoService: CryptoService, platformUtilsService: PlatformUtilsService,
|
||||
i18nService: I18nService, analytics: Angulartics2,
|
||||
auditService: AuditService, private route: ActivatedRoute,
|
||||
private router: Router, private location: Location) {
|
||||
private router: Router, private location: Location,
|
||||
broadcasterService: BroadcasterService, ngZone: NgZone,
|
||||
changeDetectorRef: ChangeDetectorRef) {
|
||||
super(cipherService, totpService, tokenService, toasterService, cryptoService, platformUtilsService,
|
||||
i18nService, analytics, auditService, window);
|
||||
i18nService, analytics, auditService, window, broadcasterService, ngZone, changeDetectorRef);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -51,6 +54,7 @@ export class ViewComponent extends BaseViewComponent implements OnInit {
|
|||
|
||||
await this.load();
|
||||
});
|
||||
super.ngOnInit();
|
||||
}
|
||||
|
||||
edit() {
|
||||
|
|
Loading…
Reference in New Issue