Merge branch 'pr/1249'

This commit is contained in:
Eugene Pankov
2019-08-07 15:10:19 +02:00
9 changed files with 57 additions and 24 deletions

View File

@@ -147,13 +147,15 @@ export abstract class BaseTabComponent {
/**
* Called before the tab is closed
*/
destroy (): void {
destroy (skipDestroyedEvent = false): void {
this.focused.complete()
this.blurred.complete()
this.titleChange.complete()
this.progress.complete()
this.recoveryStateChangedHint.complete()
this.destroyed.next()
if (!skipDestroyedEvent) {
this.destroyed.next()
}
this.destroyed.complete()
}
}

View File

@@ -1,8 +1,11 @@
import { Observable, Subject, AsyncSubject } from 'rxjs'
import { takeUntil } from 'rxjs/operators'
import { Injectable } from '@angular/core'
import { BaseTabComponent } from '../components/baseTab.component'
import { SplitTabComponent } from '../components/splitTab.component'
import { ConfigService } from './config.service'
import { HostAppService } from './hostApp.service'
import { TabRecoveryService } from './tabRecovery.service'
@@ -67,18 +70,19 @@ export class AppService {
private tabRecovery: TabRecoveryService,
private tabsService: TabsService,
) {
this.tabRecovery.recoverTabs().then(tabs => {
for (const tab of tabs) {
this.openNewTabRaw(tab.type, tab.options)
}
this.tabsChanged$.subscribe(() => {
tabRecovery.saveTabs(this.tabs)
if (hostApp.getWindow().id === 1) {
this.tabRecovery.recoverTabs().then(tabs => {
for (const tab of tabs) {
this.openNewTabRaw(tab.type, tab.options)
}
this.tabsChanged$.subscribe(() => {
tabRecovery.saveTabs(this.tabs)
})
setInterval(() => {
tabRecovery.saveTabs(this.tabs)
}, 30000)
})
setInterval(() => {
tabRecovery.saveTabs(this.tabs)
}, 30000)
})
}
}
addTabRaw (tab: BaseTabComponent) {
@@ -87,9 +91,11 @@ export class AppService {
this.tabsChanged.next()
this.tabOpened.next(tab)
tab.recoveryStateChangedHint$.subscribe(() => {
this.tabRecovery.saveTabs(this.tabs)
})
if (this.hostApp.getWindow().id === 1) {
tab.recoveryStateChangedHint$.subscribe(() => {
this.tabRecovery.saveTabs(this.tabs)
})
}
tab.titleChange$.subscribe(title => {
if (tab === this._activeTab) {
@@ -216,7 +222,7 @@ export class AppService {
}
}
for (const tab of this.tabs) {
tab.destroy()
tab.destroy(true);
}
return true
}

View File

@@ -147,6 +147,8 @@ export class HostAppService {
this.cliPaste.next(text)
} else if (op === 'profile') {
this.cliOpenProfile.next(argv.profileName)
} else if (op === undefined) {
this.newWindow();
} else {
this.secondInstance.next()
}