-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from SudhanPlayz/v1.1.2
feat: Asks only once
- Loading branch information
Showing
4 changed files
with
44 additions
and
25 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1,20 @@ | ||
const vscode = require("vscode") | ||
const LocalStorageService = require("./services/LocalStorageService") | ||
|
||
module.exports = { | ||
/** | ||
* Runs when this extenstion has been installed at first time | ||
* @param {vscode.ExtensionContext} context | ||
*/ | ||
activate: async (context) => { | ||
//TODO: Make this function only run when this extenstion installed for the first time | ||
let Clicked = await vscode.window.showInformationMessage("Thank you for installing Neon Dark Theme", "Give a star 🌟"); | ||
if(Clicked && Clicked.startsWith("Give"))vscode.env.openExternal("https://github.com/SudhanPlayz/NeonDark-Theme") | ||
const lts = new LocalStorageService(context.workspaceState) | ||
|
||
let isAsked = lts.getValue("rating") | ||
|
||
if(!isAsked){ | ||
let Clicked = await vscode.window.showInformationMessage("Thank you for installing Neon Dark Theme", "Give a star 🌟"); | ||
if(Clicked && Clicked.startsWith("Give"))vscode.env.openExternal("https://github.com/SudhanPlayz/NeonDark-Theme") | ||
lts.setValue("rating", true) | ||
} | ||
}, | ||
} |
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,32 @@ | ||
'use strict'; | ||
const { Memento } = require("vscode"); | ||
|
||
class LocalStorageService { | ||
/** | ||
* Create LocalStorage Service | ||
* @param {Memento} storage | ||
*/ | ||
constructor(storage) { | ||
this.storage = storage | ||
} | ||
|
||
/** | ||
* Get a value | ||
* @param {string} key | ||
* @returns | ||
*/ | ||
getValue(key){ | ||
return this.storage.get(key, null); | ||
} | ||
|
||
/** | ||
* Set a value | ||
* @param {string} key | ||
* @param {any} value | ||
*/ | ||
setValue(key, value){ | ||
this.storage.update(key, value ); | ||
} | ||
} | ||
|
||
module.exports = LocalStorageService |
This file was deleted.
Oops, something went wrong.