Skip to content

Commit b7da064

Browse files
committed
Adds what's new notification if page is disabled
1 parent 6483c19 commit b7da064

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

src/extension.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,21 +284,22 @@ async function showWelcomePage(version: string, previousVersion: string | undefi
284284

285285
if (previousVersion !== version) {
286286
Logger.log(`GitLens upgraded from v${previousVersion} to v${version}`);
287-
288-
if (Versions.compare(Versions.fromString(previousVersion), Versions.from(8, 0, 0)) === 0) {
289-
await commands.executeCommand(Commands.ShowWelcomePage);
290-
291-
return;
292-
}
293287
}
294288

295-
if (!Container.config.showWhatsNewAfterUpgrades) return;
296-
297289
const [major, minor] = version.split('.');
298290
const [prevMajor, prevMinor] = previousVersion.split('.');
299-
if (major === prevMajor && minor === prevMinor) return;
300-
// Don't notify on downgrades
301-
if (major < prevMajor || (major === prevMajor && minor < prevMinor)) return;
291+
if (
292+
(major === prevMajor && minor === prevMinor) ||
293+
// Don't notify on downgrades
294+
(major < prevMajor || (major === prevMajor && minor < prevMinor))
295+
) {
296+
return;
297+
}
302298

303-
await commands.executeCommand(Commands.ShowWelcomePage);
299+
if (Container.config.showWhatsNewAfterUpgrades) {
300+
await commands.executeCommand(Commands.ShowWelcomePage);
301+
}
302+
else {
303+
await Messages.showWhatsNewMessage(version);
304+
}
304305
}

src/messages.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
import { commands, ConfigurationTarget, MessageItem, Uri, window } from 'vscode';
3+
import { Commands } from './commands';
34
import { configuration, KeyMap } from './configuration';
45
import { BuiltInCommands, CommandContext, setCommandContext } from './constants';
56
import { Container } from './container';
@@ -145,7 +146,7 @@ export class Messages {
145146

146147
const result = await Messages.showMessage(
147148
'info',
148-
`While GitLens is offered to everyone for free, if you find it useful please consider supporting it. Thank you! ❤`,
149+
`While GitLens is offered to everyone for free, if you find it useful, please consider [supporting](https://gitlens.amod.io/#support-gitlens) it. Thank you! ❤`,
149150
undefined,
150151
null,
151152
...actions
@@ -171,6 +172,36 @@ export class Messages {
171172
}
172173
}
173174

175+
static async showWhatsNewMessage(version: string) {
176+
const actions: MessageItem[] = [{ title: "What's New" }, { title: 'Release Notes' }, { title: '❤' }];
177+
178+
const result = await Messages.showMessage(
179+
'info',
180+
`GitLens has been updated to v${version} — check out what's new!`,
181+
undefined,
182+
null,
183+
...actions
184+
);
185+
186+
if (result != null) {
187+
if (result === actions[0]) {
188+
await commands.executeCommand(Commands.ShowWelcomePage);
189+
}
190+
else if (result === actions[1]) {
191+
await commands.executeCommand(
192+
BuiltInCommands.Open,
193+
Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/master/CHANGELOG.md')
194+
);
195+
}
196+
else if (result === actions[2]) {
197+
await commands.executeCommand(
198+
BuiltInCommands.Open,
199+
Uri.parse('https://gitlens.amod.io/#support-gitlens')
200+
);
201+
}
202+
}
203+
}
204+
174205
private static async showMessage<T extends MessageItem>(
175206
type: 'info' | 'warn' | 'error',
176207
message: string,

0 commit comments

Comments
 (0)