|
@ -26,14 +26,14 @@ import { onIpc } from '../../../webviews/protocol'; |
|
|
import { WebviewBase } from '../../../webviews/webviewBase'; |
|
|
import { WebviewBase } from '../../../webviews/webviewBase'; |
|
|
import type { SubscriptionChangeEvent } from '../../subscription/subscriptionService'; |
|
|
import type { SubscriptionChangeEvent } from '../../subscription/subscriptionService'; |
|
|
import { ensurePlusFeaturesEnabled } from '../../subscription/utils'; |
|
|
import { ensurePlusFeaturesEnabled } from '../../subscription/utils'; |
|
|
import type { GraphCompositeConfig, GraphRepository, State } from './protocol'; |
|
|
|
|
|
|
|
|
import type { DismissBannerParams, GraphCompositeConfig, GraphRepository, State } from './protocol'; |
|
|
import { |
|
|
import { |
|
|
DidChangeCommitsNotificationType, |
|
|
DidChangeCommitsNotificationType, |
|
|
DidChangeGraphConfigurationNotificationType, |
|
|
DidChangeGraphConfigurationNotificationType, |
|
|
DidChangeNotificationType, |
|
|
DidChangeNotificationType, |
|
|
DidChangeSelectionNotificationType, |
|
|
DidChangeSelectionNotificationType, |
|
|
DidChangeSubscriptionNotificationType, |
|
|
DidChangeSubscriptionNotificationType, |
|
|
DismissPreviewCommandType, |
|
|
|
|
|
|
|
|
DismissBannerCommandType, |
|
|
GetMoreCommitsCommandType, |
|
|
GetMoreCommitsCommandType, |
|
|
UpdateColumnCommandType, |
|
|
UpdateColumnCommandType, |
|
|
UpdateSelectedRepositoryCommandType, |
|
|
UpdateSelectedRepositoryCommandType, |
|
@ -90,6 +90,7 @@ export class GraphWebview extends WebviewBase { |
|
|
private _theme: ColorTheme | undefined; |
|
|
private _theme: ColorTheme | undefined; |
|
|
|
|
|
|
|
|
private previewBanner?: boolean; |
|
|
private previewBanner?: boolean; |
|
|
|
|
|
private trialBanner?: boolean; |
|
|
|
|
|
|
|
|
constructor(container: Container) { |
|
|
constructor(container: Container) { |
|
|
super( |
|
|
super( |
|
@ -176,8 +177,8 @@ export class GraphWebview extends WebviewBase { |
|
|
|
|
|
|
|
|
protected override onMessageReceived(e: IpcMessage) { |
|
|
protected override onMessageReceived(e: IpcMessage) { |
|
|
switch (e.method) { |
|
|
switch (e.method) { |
|
|
case DismissPreviewCommandType.method: |
|
|
|
|
|
onIpc(DismissPreviewCommandType, e, () => this.dismissPreview()); |
|
|
|
|
|
|
|
|
case DismissBannerCommandType.method: |
|
|
|
|
|
onIpc(DismissBannerCommandType, e, params => this.dismissBanner(params.key)); |
|
|
break; |
|
|
break; |
|
|
case GetMoreCommitsCommandType.method: |
|
|
case GetMoreCommitsCommandType.method: |
|
|
onIpc(GetMoreCommitsCommandType, e, params => this.onGetMoreCommits(params.limit)); |
|
|
onIpc(GetMoreCommitsCommandType, e, params => this.onGetMoreCommits(params.limit)); |
|
@ -286,11 +287,15 @@ export class GraphWebview extends WebviewBase { |
|
|
this.updateState(); |
|
|
this.updateState(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private dismissPreview() { |
|
|
|
|
|
this.previewBanner = false; |
|
|
|
|
|
|
|
|
private dismissBanner(key: DismissBannerParams['key']) { |
|
|
|
|
|
if (key === 'preview') { |
|
|
|
|
|
this.previewBanner = false; |
|
|
|
|
|
} else if (key === 'trial') { |
|
|
|
|
|
this.trialBanner = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let banners = this.container.storage.getWorkspace('graph:banners:dismissed'); |
|
|
let banners = this.container.storage.getWorkspace('graph:banners:dismissed'); |
|
|
banners = updateRecordValue(banners, 'preview', true); |
|
|
|
|
|
|
|
|
banners = updateRecordValue(banners, key, true); |
|
|
void this.container.storage.storeWorkspace('graph:banners:dismissed', banners); |
|
|
void this.container.storage.storeWorkspace('graph:banners:dismissed', banners); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -436,9 +441,14 @@ export class GraphWebview extends WebviewBase { |
|
|
private async getState(): Promise<State> { |
|
|
private async getState(): Promise<State> { |
|
|
if (this.container.git.repositoryCount === 0) return { repositories: [] }; |
|
|
if (this.container.git.repositoryCount === 0) return { repositories: [] }; |
|
|
|
|
|
|
|
|
if (this.previewBanner == null) { |
|
|
|
|
|
|
|
|
if (this.previewBanner == null || this.trialBanner == null) { |
|
|
const banners = this.container.storage.getWorkspace('graph:banners:dismissed'); |
|
|
const banners = this.container.storage.getWorkspace('graph:banners:dismissed'); |
|
|
this.previewBanner = !banners?.['preview']; |
|
|
|
|
|
|
|
|
if (this.previewBanner == null) { |
|
|
|
|
|
this.previewBanner = !banners?.['preview']; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.trialBanner == null) { |
|
|
|
|
|
this.trialBanner = !banners?.['trial']; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (this.repository == null) { |
|
|
if (this.repository == null) { |
|
@ -476,6 +486,7 @@ export class GraphWebview extends WebviewBase { |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
previewBanner: this.previewBanner, |
|
|
previewBanner: this.previewBanner, |
|
|
|
|
|
trialBanner: this.trialBanner, |
|
|
repositories: formatRepositories(this.container.git.openRepositories), |
|
|
repositories: formatRepositories(this.container.git.openRepositories), |
|
|
selectedRepository: this.repository.path, |
|
|
selectedRepository: this.repository.path, |
|
|
selectedSha: this._selectedSha, |
|
|
selectedSha: this._selectedSha, |
|
|