Fixes after review

This commit is contained in:
Piotr Pekala 2019-05-28 13:41:30 -07:00
parent fc43f98f86
commit a3110e87aa
4 changed files with 17 additions and 9 deletions

View File

@ -5,6 +5,7 @@
<div class="content"> <div class="content">
<app-adbutler theme="dark"></app-adbutler> <app-adbutler theme="dark"></app-adbutler>
<mat-icon (click)="closeNotification()" class="close-button">close</mat-icon> <mat-icon (click)="closeNotification()" class="close-button">close</mat-icon>
<!-- <button class="check-button" mat-button>CHECK IT OUT</button> -->
</div> </div>
<div class="edgeline"></div> <div class="edgeline"></div>
</div> </div>

View File

@ -1,7 +1,7 @@
.notification-box { .notification-box {
posiTion: fixed; posiTion: fixed;
bottom: 10px; bottom: 20px;
right: 5px; right: 20px;
width: 412px; width: 412px;
height: 88px; height: 88px;
} }
@ -13,8 +13,8 @@
.close-button { .close-button {
position: fixed; position: fixed;
bottom: 65px; bottom: 70px;
right: 15px; right: 30px;
cursor: pointer; cursor: pointer;
} }
@ -23,7 +23,7 @@
} }
.edgeline { .edgeline {
height: 82px; height: 80px;
width: 2px; width: 2px;
background-color: #0097a7; background-color: #0097a7;
} }
@ -33,3 +33,8 @@
height: 2px; height: 2px;
background-color: #0097a7; background-color: #0097a7;
} }
.check-button {
background-color: #0097a7;
margin-top: -10px;
}

View File

@ -13,8 +13,9 @@ export class NotificationBoxComponent implements OnInit {
notificationSettings: NotificationSettings; notificationSettings: NotificationSettings;
timer: Observable<number>; timer: Observable<number>;
timerSubscription: Subscription; timerSubscription: Subscription;
intervalSubscription: Subscription;
viewsCounter = 0; viewsCounter = 0;
ticks: number = 0; ticks: number = 1000;
progress: number = 0; progress: number = 0;
isVisible = false; isVisible = false;
interval = 10; interval = 10;
@ -33,7 +34,7 @@ export class NotificationBoxComponent implements OnInit {
this.timerSubscription = this.timer.subscribe(() => { this.timerSubscription = this.timer.subscribe(() => {
this.ticks++; this.ticks++;
if (this.ticks > this.notificationSettings.breakTime) { if (this.ticks > this.notificationSettings.breakTime && navigator.onLine) {
this.ticks = 0; this.ticks = 0;
this.showNotification(); this.showNotification();
this.viewsCounter++; this.viewsCounter++;
@ -50,10 +51,11 @@ export class NotificationBoxComponent implements OnInit {
this.isVisible = true; this.isVisible = true;
this.progress = 0; this.progress = 0;
interval(this.interval).pipe(take(this.notificationSettings.viewTime)).subscribe(() => { this.intervalSubscription = interval(this.interval).pipe(take(this.notificationSettings.viewTime)).subscribe(() => {
this.progress += (1/this.interval); this.progress += (1/this.interval);
if (this.progress > ((this.notificationSettings.viewTime/this.interval)-(1/this.interval))) { if (this.progress > ((this.notificationSettings.viewTime/this.interval)-(1/this.interval))) {
this.isVisible = false; this.isVisible = false;
this.intervalSubscription.unsubscribe();
} }
}); });
} }

View File

@ -8,7 +8,7 @@ export class NotificationSettingsService {
getConfiguration(): NotificationSettings { getConfiguration(): NotificationSettings {
let configuration: NotificationSettings = { let configuration: NotificationSettings = {
delayTime: 1000, delayTime: 0,
viewTime: 1000, viewTime: 1000,
breakTime: 1000, breakTime: 1000,
isEndless: true, isEndless: true,