Skip to content

Commit aa129ab

Browse files
axosoft-raminteamodio
authored andcommitted
Takes Launchpad View out of Experimental
Adds gating states where needed
1 parent a43f4bf commit aa129ab

File tree

2 files changed

+66
-35
lines changed

2 files changed

+66
-35
lines changed

package.json

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,16 +1658,9 @@
16581658
},
16591659
{
16601660
"id": "launchpad-view",
1661-
"title": "Launchpad View (ᴇxᴘᴇʀɪᴍᴇɴᴛᴀʟ)",
1661+
"title": "Launchpad View (ᴘʀᴏ)",
16621662
"order": 101,
16631663
"properties": {
1664-
"gitlens.views.launchpad.enabled": {
1665-
"type": "boolean",
1666-
"default": false,
1667-
"markdownDescription": "(Experimental) Specifies whether to enable an experimental _Launchpad_ view",
1668-
"scope": "window",
1669-
"order": 10
1670-
},
16711664
"gitlens.views.launchpad.files.layout": {
16721665
"type": "string",
16731666
"default": "auto",
@@ -19077,13 +19070,57 @@
1907719070
},
1907819071
{
1907919072
"view": "gitlens.views.launchpad",
19080-
"contents": "[Launchpad](command:gitlens.views.launchpad.info \"Learn about Launchpad\") — organizes your pull requests into actionable groups to help you focus and keep your team unblocked.",
19081-
"when": "config.gitlens.views.launchpad.enabled"
19073+
"contents": "[Launchpad](command:gitlens.views.launchpad.info \"Learn about Launchpad\") — organizes your pull requests into actionable groups to help you focus and keep your team unblocked."
1908219074
},
1908319075
{
1908419076
"view": "gitlens.views.launchpad",
1908519077
"contents": "[Connect an Integration...](command:gitlens.showLaunchpad?%7B%22source%22%3A%22launchpad-view%22%7D)\n\nAllows Launchpad to organize your pull requests into actionable groups and keep your team unblocked.",
19086-
"when": "config.gitlens.views.launchpad.enabled && gitlens:launchpad:connect"
19078+
"when": "gitlens:launchpad:connect"
19079+
},
19080+
{
19081+
"view": "gitlens.views.launchpad",
19082+
"contents": "[Resend Verification Email](command:gitlens.plus.resendVerification?%7B%22source%22%3A%22launchpad-view%22%7D)\n\nYou must verify your email before you can continue or [recheck Status](command:gitlens.plus.validate?%7B%22source%22%3A%22launchpad-view%22%7D).",
19083+
"when": "!gitlens:launchpad:connect && gitlens:plus:state == -1"
19084+
},
19085+
{
19086+
"view": "gitlens.views.launchpad",
19087+
"contents": "[Continue](command:gitlens.plus.startPreviewTrial?%7B%22source%22%3A%22launchpad-view%22%7D)\n\nContinuing gives you 3 days to preview Launchpad and other local Pro features for 3 days. [Start 7-day Pro trial](command:gitlens.plus.signUp?%7B%22source%22%3A%22launchpad-view%22%7D) or [sign in](command:gitlens.plus.login?%7B%22source%22%3A%22launchpad-view%22%7D) for full access to Pro features.",
19088+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 0"
19089+
},
19090+
{
19091+
"view": "gitlens.views.launchpad",
19092+
"contents": "[Start Pro Trial](command:gitlens.plus.signUp?%7B%22source%22%3A%22launchpad-view%22%7D)\n\nStart your free 7-day Pro trial to try Launchpad and other Pro features, or [sign in](command:gitlens.plus.login?%7B%22source%22%3A%22launchpad-view%22%7D).",
19093+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 2"
19094+
},
19095+
{
19096+
"view": "gitlens.views.launchpad",
19097+
"contents": "[Upgrade to Pro](command:gitlens.plus.upgrade?%7B%22source%22%3A%22launchpad-view%22%7D)",
19098+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4"
19099+
},
19100+
{
19101+
"view": "gitlens.views.launchpad",
19102+
"contents": "Limited-time sale: Save 33% or more on your 1st seat of Pro.",
19103+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && (gitlens:promo == pro50 || !gitlens:promo)"
19104+
},
19105+
{
19106+
"view": "gitlens.views.launchpad",
19107+
"contents": "Limited-time sale: Save up to 80% on GitLens Pro",
19108+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == devexdays"
19109+
},
19110+
{
19111+
"view": "gitlens.views.launchpad",
19112+
"contents": "Your Pro trial has ended. Please upgrade for full access to Launchpad and other Pro features.",
19113+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4"
19114+
},
19115+
{
19116+
"view": "gitlens.views.launchpad",
19117+
"contents": "[Continue](command:gitlens.plus.reactivateProTrial?%7B%22source%22%3A%22launchpad-view%22%7D)\n\nReactivate your Pro trial and experience Launchpad and all the new Pro features — free for another 7 days!",
19118+
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 5"
19119+
},
19120+
{
19121+
"view": "gitlens.views.launchpad",
19122+
"contents": "Pro feature — requires a paid plan for use on privately-hosted repos.",
19123+
"when": "!gitlens:launchpad:connect"
1908719124
},
1908819125
{
1908919126
"view": "gitlens.views.workspaces",
@@ -19226,7 +19263,6 @@
1922619263
{
1922719264
"id": "gitlens.views.launchpad",
1922819265
"name": "Launchpad",
19229-
"when": "config.gitlens.views.launchpad.enabled",
1923019266
"contextualTitle": "GitLens",
1923119267
"icon": "$(rocket)",
1923219268
"initialSize": 2,

src/views/launchpadView.ts

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import type { ConfigurationChangeEvent, MessageItem, TreeViewVisibilityChangeEvent } from 'vscode';
1+
import type { ConfigurationChangeEvent, TreeViewVisibilityChangeEvent } from 'vscode';
22
import { Disposable, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri, window } from 'vscode';
33
import type { OpenWalkthroughCommandArgs } from '../commands/walkthroughs';
44
import type { LaunchpadViewConfig, ViewFilesLayout } from '../config';
5-
import { experimentalBadge } from '../constants';
65
import { Commands } from '../constants.commands';
76
import type { Container } from '../container';
87
import { AuthenticationRequiredError } from '../errors';
8+
import { PlusFeatures } from '../features';
99
import { GitUri, unknownGitUri } from '../git/gitUri';
10+
import type { SubscriptionChangeEvent } from '../plus/gk/account/subscriptionService';
11+
import { ensurePlusFeaturesEnabled } from '../plus/gk/utils';
1012
import type { LaunchpadCommandArgs } from '../plus/launchpad/launchpad';
1113
import type { LaunchpadGroup, LaunchpadItem } from '../plus/launchpad/launchpadProvider';
1214
import {
@@ -125,14 +127,23 @@ export class LaunchpadViewNode extends CacheableChildrenViewNode<
125127

126128
constructor(view: LaunchpadView) {
127129
super('launchpad', unknownGitUri, view);
128-
this.disposable = Disposable.from(this.view.container.launchpad.onDidChange(this.refresh, this));
130+
this.disposable = Disposable.from(
131+
this.view.container.launchpad.onDidChange(this.refresh, this),
132+
this.view.container.subscription.onDidChange(this.onSubscriptionChanged, this),
133+
);
129134
}
130135

131136
override dispose() {
132137
this.disposable?.dispose();
133138
super.dispose();
134139
}
135140

141+
private onSubscriptionChanged(e: SubscriptionChangeEvent) {
142+
if (e.current.plan !== e.previous.plan) {
143+
void this.triggerChange(true);
144+
}
145+
}
146+
136147
override refresh() {
137148
if (this.children == null) return;
138149

@@ -142,6 +153,9 @@ export class LaunchpadViewNode extends CacheableChildrenViewNode<
142153

143154
async getChildren(): Promise<(GroupingNode | LaunchpadItemNode)[]> {
144155
if (this.children == null) {
156+
const access = await this.view.container.git.access(PlusFeatures.Launchpad);
157+
if (!access.allowed) return [];
158+
145159
const children: (GroupingNode | LaunchpadItemNode)[] = [];
146160

147161
this.view.message = undefined;
@@ -208,8 +222,6 @@ export class LaunchpadView extends ViewBase<'launchpad', LaunchpadViewNode, Laun
208222

209223
constructor(container: Container) {
210224
super(container, 'launchpad', 'Launchpad', 'launchpadView');
211-
212-
this.description = experimentalBadge;
213225
}
214226

215227
override dispose() {
@@ -233,24 +245,7 @@ export class LaunchpadView extends ViewBase<'launchpad', LaunchpadViewNode, Laun
233245
}
234246

235247
override async show(options?: { preserveFocus?: boolean | undefined }): Promise<void> {
236-
if (!configuration.get('views.launchpad.enabled')) {
237-
const confirm: MessageItem = { title: 'Enable' };
238-
const cancel: MessageItem = { title: 'Cancel', isCloseAffordance: true };
239-
const result = await window.showInformationMessage(
240-
'Would you like to try the new experimental Launchpad view?',
241-
{
242-
modal: true,
243-
detail: 'Launchpad organizes your pull requests into actionable groups to help you focus and keep your team unblocked.',
244-
},
245-
confirm,
246-
cancel,
247-
);
248-
249-
if (result !== confirm) return;
250-
251-
await configuration.updateEffective('views.launchpad.enabled', true);
252-
}
253-
248+
if (!(await ensurePlusFeaturesEnabled())) return;
254249
return super.show(options);
255250
}
256251

0 commit comments

Comments
 (0)