update clipboard, fix timeslots

This commit is contained in:
_Bastler 2021-11-18 17:48:28 +01:00
parent 2cede86ea8
commit 86d352f549
7 changed files with 103 additions and 128 deletions

View File

@ -8,7 +8,7 @@ import { HttpClientModule, HttpInterceptor, HttpHandler, HttpRequest, HTTP_INTER
import { MaterialModule } from './material/material.module';
import { QrCodeModule } from 'ng-qrcode';
import { DatePipe } from '@angular/common';
import { ClipboardModule } from '@angular/cdk/clipboard';
import { AutofocusDirective } from './material/autofocus';
@ -125,6 +125,7 @@ export class XhrInterceptor implements HttpInterceptor {
],
imports: [
BrowserModule,
ClipboardModule,
AppRoutingModule,
BrowserAnimationsModule,
MaterialModule,
@ -132,6 +133,7 @@ export class XhrInterceptor implements HttpInterceptor {
FormsModule,
ReactiveFormsModule,
QrCodeModule,
],
exports: [ MaterialModule ],
providers: [ { provide: APP_INITIALIZER, useFactory: init_app, deps: [ I18nService ], multi: true }, { provide: HTTP_INTERCEPTORS, useClass: XhrInterceptor, multi: true }, DatePipe,

View File

@ -6,6 +6,7 @@ import {FormBuilder, FormGroup, Validators, NgForm} from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ConfirmDialog } from '../../../ui/confirm/confirm.component';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Clipboard } from '@angular/cdk/clipboard';
@Component({
selector: 'app-account-domains',
@ -31,7 +32,8 @@ export class DomainsComponent implements OnInit {
private userDomainService: UserDomainService,
private i18n: I18nService,
private snackBar: MatSnackBar,
public dialog: MatDialog) {}
public dialog: MatDialog,
private clipboard: Clipboard) { }
ngOnInit(): void {
this.form = this.formBuilder.group({
@ -97,13 +99,7 @@ export class DomainsComponent implements OnInit {
}
copySecret(domain: any) {
const selBox = document.createElement('textarea');
selBox.value = domain.secret;
document.body.appendChild(selBox);
selBox.focus();
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
this.clipboard.copy(domain.secret);
this.snackBar.open(this.i18n.get("user.domains.secret.copied", []), this.i18n.get("close", []), {
duration: 3000
});

View File

@ -5,10 +5,10 @@ import { FormBuilder, FormGroup, Validators, NgForm } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { DatePipe } from '@angular/common';
import { PageEvent } from '@angular/material/paginator';
import { Clipboard } from '@angular/cdk/clipboard';
import { QuotaService } from '../../services/quota.service';
import { JitsiService } from '../../services/jitsi.service';
import { UrlShortenerService } from '../../services/urlshortener.service';
import { ConfirmDialog } from '../../ui/confirm/confirm.component';
import { I18nService } from './../../services/i18n.service';
@ -39,7 +39,8 @@ export class JitsiComponent implements OnInit {
private jitsiService: JitsiService,
private snackBar: MatSnackBar,
private i18n: I18nService,
public dialog: MatDialog) { }
public dialog: MatDialog,
private clipboard: Clipboard) { }
ngOnInit(): void {
this.datetimeformat = this.i18n.get('format.datetime', []);
@ -157,13 +158,7 @@ export class JitsiComponent implements OnInit {
}
copyRoomUrlToClipboard(jitsiRoom: any) {
const selBox = document.createElement('textarea');
selBox.value = jitsiRoom.url;
document.body.appendChild(selBox);
selBox.focus();
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
this.clipboard.copy(jitsiRoom.url);
this.snackBar.open(this.i18n.get("jitsi.rooms.clipboard.copied", []), this.i18n.get("close", []), {
duration: 3000
});
@ -259,6 +254,7 @@ export class JitsiShareDialog {
constructor(
private i18n: I18nService,
private snackBar: MatSnackBar,
private clipboard: Clipboard,
private datePipe: DatePipe,
public dialogRef: MatDialogRef<JitsiShareDialog>,
@Inject(MAT_DIALOG_DATA) public data: any) {
@ -279,13 +275,7 @@ export class JitsiShareDialog {
}
copyToClipboard(text) {
const selBox = document.createElement('textarea');
selBox.value = text;
document.body.appendChild(selBox);
selBox.focus();
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
this.clipboard.copy(text);
this.snackBar.open(this.i18n.get("jitsi.share.clipboard.copied", []), this.i18n.get("close", []), {
duration: 3000
});

View File

@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common';
import { FormControl } from '@angular/forms';
import { debounceTime } from 'rxjs/operators';
import { PageEvent } from '@angular/material/paginator';
import { Clipboard } from '@angular/cdk/clipboard';
import { ParteyTimeslotsService } from '../../../services/partey.service';
import { ConfirmDialog } from '../../../ui/confirm/confirm.component';
@ -49,7 +50,8 @@ export class ParteyTimeslotsComponent implements OnInit {
private i18n: I18nService,
private datePipe: DatePipe,
private snackBar: MatSnackBar,
public dialog: MatDialog) { }
public dialog: MatDialog,
private clipboard: Clipboard) { }
ngOnInit(): void {
@ -182,13 +184,7 @@ export class ParteyTimeslotsComponent implements OnInit {
}
copySecretToClipboard(secret) {
const selBox = document.createElement('textarea');
selBox.value = secret;
document.body.appendChild(selBox);
selBox.focus();
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
this.clipboard.copy(secret);
this.snackBar.open(this.i18n.get("partey.timeslots.secret.copied", []), this.i18n.get("close", []), {
duration: 3000
});
@ -209,7 +205,7 @@ export class ParteyTimeslotDialog {
timeslot;
visibilities = [ "PRIVATE", "PROTECTED", "PUBLIC" ];
types = [ "VIDEO", "AUDIO" ];
types = [ "VIDEO", "AUDIO", "AUDIO_STREAM", "VIDEO_STREAM" ];
constructor(
private parteyTimeslotsService: ParteyTimeslotsService,
@ -226,12 +222,11 @@ export class ParteyTimeslotDialog {
ends: [ '', Validators.required ],
title: [ '', Validators.nullValidator ],
description: [ '', Validators.nullValidator ],
stream: [ '', this.timeslot.type == 'VIDEO' ? Validators.required : Validators.nullValidator ],
stream: [ '', this.timeslot.type == 'VIDEO_STREAM' ? Validators.required : Validators.nullValidator ],
share: [ '', (this.timeslot.type == 'VIDEO' || this.timeslot.type == 'AUDIO') ? Validators.required : Validators.nullValidator ],
});
}
create(timeslot) {
this.parteyTimeslotsService.create(timeslot).subscribe((result: any) => {
this.dialogRef.close(timeslot);

View File

@ -3,6 +3,7 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Router } from '@angular/router';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Clipboard } from '@angular/cdk/clipboard';
import { UserService } from './../../services/user.service';
import { ItemService } from './../../services/item.service';
@ -173,6 +174,7 @@ export class RegisterDialog {
constructor(private router: Router,
private i18n: I18nService,
private snackBar: MatSnackBar,
private clipboard: Clipboard,
public dialogRef: MatDialogRef<RegisterDialog>,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
@ -187,10 +189,7 @@ export class RegisterDialog {
}
copyKey(inputElement) {
inputElement.select();
document.execCommand('copy');
inputElement.setSelectionRange(0, 0);
this.downloaded = true;
this.clipboard.copy(inputElement.value);
this.snackBar.open(this.i18n.get("pgp.privateKey.copied", []), this.i18n.get("close", []), {
duration: 3000
});

View File

@ -5,6 +5,7 @@ import { FormBuilder, FormGroup, Validators, NgForm, FormControl } from '@angula
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { PageEvent } from '@angular/material/paginator';
import { ActivatedRoute } from '@angular/router';
import { Clipboard } from '@angular/cdk/clipboard';
import { MatchingValidator } from './../../utils/matching.validator';
import { QuotaService } from '../../services/quota.service';
@ -268,6 +269,7 @@ export class UrlShortenerShareDialog {
constructor(
private i18n: I18nService,
private snackBar: MatSnackBar,
private clipboard: Clipboard,
public dialogRef: MatDialogRef<UrlShortenerShareDialog>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.shortenedUrl = data;
@ -279,13 +281,7 @@ export class UrlShortenerShareDialog {
}
copyToClipboard(text) {
const selBox = document.createElement('textarea');
selBox.value = text;
document.body.appendChild(selBox);
selBox.focus();
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
this.clipboard.copy(text);
this.snackBar.open(this.i18n.get("urlshortener.share.clipboard.copied", []), this.i18n.get("close", []), {
duration: 3000
});

View File

@ -1,12 +1,11 @@
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Clipboard } from '@angular/cdk/clipboard';
import { AuthService } from '../../../../services/auth.service';
import { I18nService } from '../../../../services/i18n.service';
var openpgp = require('openpgp');
@Component({
@ -24,7 +23,8 @@ export class ProfileFieldPgpBlob implements OnInit {
public dialogRef: MatDialogRef<ProfileFieldPgpBlob>,
private i18n: I18nService,
private authService: AuthService,
private snackBar: MatSnackBar) {
private snackBar: MatSnackBar,
private clipboard: Clipboard) {
this.data = {};
}
@ -56,10 +56,7 @@ export class ProfileFieldPgpBlob implements OnInit {
}
copyKey(inputElement) {
inputElement.select();
document.execCommand('copy');
inputElement.setSelectionRange(0, 0);
this.downloaded = true;
this.clipboard.copy(inputElement.value);
this.snackBar.open(this.i18n.get("pgp.privateKey.copied", []), this.i18n.get("close", []), {
duration: 3000
});