|
|
|
|
@ -1,15 +1,23 @@
@@ -1,15 +1,23 @@
|
|
|
|
|
import { |
|
|
|
|
ChangeDetectorRef, |
|
|
|
|
Component, |
|
|
|
|
NgZone, |
|
|
|
|
OnDestroy, |
|
|
|
|
OnInit, |
|
|
|
|
} from '@angular/core'; |
|
|
|
|
|
|
|
|
|
import { ToasterService } from 'angular2-toaster'; |
|
|
|
|
|
|
|
|
|
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; |
|
|
|
|
|
|
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service'; |
|
|
|
|
import { MessagingService } from 'jslib/abstractions/messaging.service'; |
|
|
|
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; |
|
|
|
|
|
|
|
|
|
import { ConfigurationService } from '../../services/configuration.service'; |
|
|
|
|
|
|
|
|
|
const BroadcasterSubscriptionId = 'MoreComponent'; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-more', |
|
|
|
|
templateUrl: 'more.component.html', |
|
|
|
|
@ -17,17 +25,42 @@ import { ConfigurationService } from '../../services/configuration.service';
@@ -17,17 +25,42 @@ import { ConfigurationService } from '../../services/configuration.service';
|
|
|
|
|
export class MoreComponent implements OnInit { |
|
|
|
|
version: string; |
|
|
|
|
year: string; |
|
|
|
|
checkingForUpdate = false; |
|
|
|
|
|
|
|
|
|
constructor(private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, |
|
|
|
|
private messagingService: MessagingService, private configurationService: ConfigurationService, |
|
|
|
|
private toasterService: ToasterService) { } |
|
|
|
|
private toasterService: ToasterService, private broadcasterService: BroadcasterService, |
|
|
|
|
private ngZone: NgZone, private changeDetectorRef: ChangeDetectorRef) { } |
|
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
|
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => { |
|
|
|
|
this.ngZone.run(async () => { |
|
|
|
|
switch (message.command) { |
|
|
|
|
case 'checkingForUpdate': |
|
|
|
|
this.checkingForUpdate = true; |
|
|
|
|
break; |
|
|
|
|
case 'doneCheckingForUpdate': |
|
|
|
|
this.checkingForUpdate = false; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.changeDetectorRef.detectChanges(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.year = new Date().getFullYear().toString(); |
|
|
|
|
this.version = this.platformUtilsService.getApplicationVersion(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async update() { } |
|
|
|
|
ngOnDestroy() { |
|
|
|
|
this.broadcasterService.unsubscribe(BroadcasterSubscriptionId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
update() { |
|
|
|
|
this.messagingService.send('checkForUpdate'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async logOut() { |
|
|
|
|
const confirmed = await this.platformUtilsService.showDialog( |
|
|
|
|
|