Remove notification feature

This commit is contained in:
death-claw
2020-08-16 11:26:57 +01:00
parent c825b22ce4
commit efcc685f30
8 changed files with 6 additions and 57 deletions
@@ -139,11 +139,6 @@ public class AppSettingsService {
settings.setViewPhotos(false);
}
if (settings.getNotification() == null) {
settings.setNotification(false);
}
save();
}
@@ -237,8 +232,6 @@ public class AppSettingsService {
private Boolean clearCompleted;
@JsonProperty("viewPhotos")
private Boolean viewPhotos;
@JsonProperty("notification")
private Boolean notification;
@JsonProperty("darkTheme")
private Boolean darkTheme;
+1 -1
View File
@@ -38,7 +38,7 @@ export class ClipboardService {
_init(settings: Settings) {
if (!this.electronService.isElectronApp) {
console.log('Clipboard deactive, not an electron app');
console.log('Clipboard deactivated, not an electron app');
return;
}
if (this.interval != null) {
@@ -9,6 +9,5 @@ export interface Settings {
vThanks: boolean;
desktopClipboard: boolean;
viewPhotos: boolean;
notification: boolean;
resolveTitle: boolean;
}
@@ -1,10 +1,9 @@
import {LinkCollectorService} from './../link-collector.service';
import {LinkCollectorService} from '../link-collector.service';
import {UrlGrabRendererComponent} from './renderer/url-renderer.component';
import {GrabQueueDataSource} from './grab-queue.datasource';
import {ChangeDetectionStrategy, Component, NgZone, OnInit} from '@angular/core';
import {GridOptions} from 'ag-grid-community';
import {WsConnectionService} from '../ws-connection.service';
import {NotificationService} from '../notification.service';
@Component({
selector: 'app-grab-queue',
@@ -16,8 +15,7 @@ export class GrabQueueComponent implements OnInit {
constructor(
private wsConnection: WsConnectionService,
private zone: NgZone,
private linkCollectorService: LinkCollectorService,
private notificationService: NotificationService) {
private linkCollectorService: LinkCollectorService) {
this.gridOptions = <GridOptions>{
columnDefs: [
{
@@ -40,7 +38,7 @@ export class GrabQueueComponent implements OnInit {
getRowNodeId: data => data['threadId'],
onGridReady: () => {
this.gridOptions.api.sizeColumnsToFit();
this.dataSource = new GrabQueueDataSource(this.wsConnection, this.gridOptions, this.zone, this.notificationService);
this.dataSource = new GrabQueueDataSource(this.wsConnection, this.gridOptions, this.zone);
this.dataSource.connect();
},
onGridSizeChanged: () => this.gridOptions.api.sizeColumnsToFit(),
@@ -1,7 +1,6 @@
import {GrabQueueState} from '../domain/grab-queue.model';
import {Subscription} from 'rxjs';
import {WsConnectionService} from '../ws-connection.service';
import {NotificationService} from '../notification.service';
import {GridOptions, RowNode} from 'ag-grid-community';
import {NgZone} from '@angular/core';
@@ -9,8 +8,7 @@ export class GrabQueueDataSource {
constructor(
private ws: WsConnectionService,
private gridOptions: GridOptions,
private zone: NgZone,
private notificationService: NotificationService
private zone: NgZone
) {
}
@@ -30,13 +28,6 @@ export class GrabQueueDataSource {
}
});
this.gridOptions.api.applyTransaction({update: toUpdate, add: toAdd});
const count = this.gridOptions.api.getDisplayedRowCount();
if (count > 0 && toAdd.length > 0) {
this.notificationService.notifyFromGrabQueue(
'Link Collector',
`You have ${count} ${count > 1 ? 'threads' : 'thread'} waiting in the link collector`
);
}
});
}));
@@ -1,26 +0,0 @@
import { Injectable } from '@angular/core';
import { AppService } from './app.service';
@Injectable({
providedIn: 'root'
})
export class NotificationService {
constructor(private appService: AppService) {}
notifyFromGrabQueue(title: string, body: string) {
if (!this.appService.settings.notification) {
return;
}
if (!('Notification' in window)) {
return;
} else if (Notification.permission === 'granted') {
const notification = new Notification(title, { body: body, icon: 'assets/icon.png' });
} else if (Notification.permission !== 'denied') {
Notification.requestPermission().then(function(permission) {
if (permission === 'granted') {
const notification = new Notification(title, { body: body, icon: 'assets/icon.png' });
}
});
}
}
}
@@ -110,11 +110,6 @@
>Monitor Clipboard
</mat-checkbox
>
<mat-checkbox color="primary" formControlName="notification" name="notification"
>Enable system notifications
</mat-checkbox
>
</form>
</mat-tab>
</mat-tab-group>
@@ -46,8 +46,7 @@ export class SettingsComponent implements OnInit {
});
desktopSettingsForm = new FormGroup({
desktopClipboard: new FormControl(false),
notification: new FormControl(false)
desktopClipboard: new FormControl(false)
});
darkTheme = false;