Skip to content

Commit

Permalink
Merge pull request #11 from SudhanPlayz/v1.1.2
Browse files Browse the repository at this point in the history
feat: Asks only once
  • Loading branch information
SudhanPlayz authored Oct 31, 2021
2 parents 99c74ee + 3ca77a9 commit 0abaa5c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 25 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"name": "neondark-theme",
"displayName": "Neon Dark Theme",
"description": "An eye-catching neon theme which powerup your code editor into awesome code editor",
"version": "1.1.1",
"version": "1.1.2",
"publisher": "Sudhan",
"browser": "./src/index.js",
"author": {
"name": "SudhanPlayz",
"url": "https://github.com/SudhanPlayz"
Expand Down
13 changes: 10 additions & 3 deletions src/index.js
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)
}
},
}
32 changes: 32 additions & 0 deletions src/services/LocalStorageService.js
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
21 changes: 0 additions & 21 deletions styles/theme.css

This file was deleted.

0 comments on commit 0abaa5c

Please sign in to comment.