-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add popup asking for star/review - but only once for each installation
0.1.3
- Loading branch information
1 parent
2c4cc92
commit d4bebf5
Showing
4 changed files
with
54 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as vscode from "vscode"; | ||
|
||
export function askForStar(context: vscode.ExtensionContext) { | ||
const askForStarKey = "didAskForStart"; | ||
const didAlreadyAsk = !!context.globalState.get(askForStarKey); | ||
|
||
if (didAlreadyAsk) { | ||
return; | ||
} | ||
|
||
const superAnswer = "Ok"; | ||
const closeAnswer = "Close"; | ||
vscode.window | ||
.showInformationMessage( | ||
`If you like this extension and it helps you - consider giving it a star on ` + | ||
`[Github](https://github.com/piotrgredowski/poor-mans-t-sql-formatter-vscode-extension) or writing a review in ` + | ||
`[VSCode marketplace](https://marketplace.visualstudio.com/items?itemName=piotrgredowski.poor-mans-t-sql-formatter-pg&ssr=false#review-details) to make maintainer motivated!`, | ||
{ modal: false }, | ||
...[superAnswer, closeAnswer] | ||
) | ||
.then((answer) => { | ||
context.globalState.update(askForStarKey, false); | ||
|
||
if (answer === superAnswer) { | ||
vscode.window.showInformationMessage("Thank you!", closeAnswer); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters