2018-10-23 15:25:44 +02:00
|
|
|
import { Location } from '@angular/common';
|
2018-10-23 16:29:05 +02:00
|
|
|
import { Component } from '@angular/core';
|
2018-10-23 22:17:30 +02:00
|
|
|
import {
|
|
|
|
ActivatedRoute,
|
|
|
|
Router,
|
|
|
|
} from '@angular/router';
|
2018-10-23 15:25:44 +02:00
|
|
|
|
|
|
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
|
|
|
import { CollectionService } from 'jslib/abstractions/collection.service';
|
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
|
|
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
2018-10-23 16:29:05 +02:00
|
|
|
import { UserService } from 'jslib/abstractions/user.service';
|
2018-10-23 15:25:44 +02:00
|
|
|
|
2018-10-23 16:29:05 +02:00
|
|
|
import { ShareComponent as BaseShareComponent } from 'jslib/angular/components/share.component';
|
2018-10-23 15:25:44 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-vault-share',
|
|
|
|
templateUrl: 'share.component.html',
|
|
|
|
})
|
2018-10-23 16:29:05 +02:00
|
|
|
export class ShareComponent extends BaseShareComponent {
|
|
|
|
constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService,
|
|
|
|
i18nService: I18nService, userService: UserService,
|
|
|
|
cipherService: CipherService, private route: ActivatedRoute,
|
2018-10-23 22:17:30 +02:00
|
|
|
private location: Location, private router: Router) {
|
2018-10-23 16:29:05 +02:00
|
|
|
super(collectionService, platformUtilsService, i18nService, userService, cipherService);
|
2018-10-23 15:25:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async ngOnInit() {
|
2018-10-23 22:17:30 +02:00
|
|
|
this.onSharedCipher.subscribe(() => {
|
|
|
|
this.router.navigate(['view-cipher', { cipherId: this.cipherId }]);
|
|
|
|
});
|
2018-12-20 16:20:57 +01:00
|
|
|
const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
|
2018-10-23 16:29:05 +02:00
|
|
|
this.cipherId = params.cipherId;
|
|
|
|
await super.ngOnInit();
|
2018-12-20 16:20:57 +01:00
|
|
|
queryParamsSub.unsubscribe();
|
2018-10-23 15:25:44 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
cancel() {
|
|
|
|
this.location.back();
|
|
|
|
}
|
|
|
|
}
|