Skip to content

Commit a932977

Browse files
committed
1.7 - Updating notifications
1 parent 6f98088 commit a932977

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/app/app.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ export class AppComponent implements OnInit {
301301
document.execCommand('Copy');
302302
this._shared.triggerNotify('Copied');
303303
this.updateNotify();
304+
} else {
305+
setTimeout(() => {
306+
document.execCommand('Copy');
307+
this._shared.triggerNotify('Copied');
308+
this.updateNotify();
309+
}, 1000);
304310
}
305311
}
306312

src/app/components/youtube-settings.component.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Http } from '@angular/http';
1414
export class SettingsComponent implements OnInit {
1515

1616
private finished = false;
17+
notify: any;
1718

1819
_shared: any;
1920
_fb: any;
@@ -41,6 +42,7 @@ export class SettingsComponent implements OnInit {
4142
this._fb = fb;
4243
this._app = app;
4344
this._search = search;
45+
this.notify = this._shared.notify;
4446
}
4547

4648
ngOnInit() {
@@ -66,6 +68,7 @@ export class SettingsComponent implements OnInit {
6668
});
6769
this._app.setSettings(this.settings, 0);
6870
this._search.setSettings(this.settings, 1);
71+
this.notifySettings();
6972
});
7073
}
7174

@@ -95,6 +98,24 @@ export class SettingsComponent implements OnInit {
9598
this._shared.feedVideos = null;
9699
this._app.getSettings();
97100
this._app.getFeedVideos();
101+
this.notifySettings();
98102
setTimeout(() => this.loadingRegion = false, 100);
99103
}
104+
105+
notifySettings() {
106+
if (!this.notify.enabled) {
107+
this._shared.triggerNotify('Changed');
108+
this.updateNotify();
109+
} else {
110+
setTimeout(() => {
111+
this._shared.triggerNotify('Changed');
112+
this.updateNotify();
113+
}, 1000);
114+
}
115+
}
116+
117+
updateNotify() {
118+
this.notify = this._shared.notify;
119+
setTimeout(() => this.notify = this._shared.notify, 1000);
120+
}
100121
}

0 commit comments

Comments
 (0)