Skip to content

Commit

Permalink
1.0.10
Browse files Browse the repository at this point in the history
Hide/show plugin descriptions
NPM audit
  • Loading branch information
alangrainger committed Aug 26, 2024
1 parent 7d79926 commit 077ed2e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 21 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "lazy-plugins",
"name": "Lazy Plugin Loader",
"version": "1.0.9",
"version": "1.0.10",
"minAppVersion": "1.6.0",
"description": "Load plugins with a delay on startup, so that you can get your app startup down into the sub-second loading time.",
"author": "Alan Grainger",
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lazy-plugins",
"version": "1.0.9",
"version": "1.0.10",
"description": "Load plugins with a delay on startup, so that you can get your app startup down into the sub-second loading time.",
"main": "main.js",
"scripts": {
Expand Down
11 changes: 0 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,6 @@ export default class LazyPlugin extends Plugin {
async loadSettings () {
this.data = Object.assign({}, DEFAULT_SETTINGS, await this.loadData())

// Migration from from plugin version <1.0.6
// This will be deleted in a few weeks.
if (this.data.hasOwnProperty('plugins')) {
['plugins', 'defaultStartupType', 'shortDelaySeconds', 'longDelaySeconds'].forEach(key => {
// @ts-ignore
this.data.desktop[key] = this.data[key]
// @ts-ignore
delete this.data[key]
})
}

// If user has dual mobile/desktop settings enabled
if (this.data.dualConfigs && Platform.isMobile) {
if (!this.data.mobile) {
Expand Down
26 changes: 24 additions & 2 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ export const DEFAULT_DEVICE_SETTINGS: DeviceSettings = {
export interface LazySettings {
dualConfigs: boolean;
showConsoleLog: boolean;
showDescriptions: boolean;
desktop: DeviceSettings;
mobile?: DeviceSettings;
}

export const DEFAULT_SETTINGS: LazySettings = {
dualConfigs: false,
showConsoleLog: false,
showDescriptions: true,
desktop: DEFAULT_DEVICE_SETTINGS
}

Expand Down Expand Up @@ -117,6 +119,17 @@ export class SettingsTab extends PluginSettingTab {
.setName('Individual plugin delay settings')
.setHeading()

new Setting(containerEl)
.setName('Show plugin descriptions')
.addToggle(toggle => {
toggle
.setValue(this.lazyPlugin.data.showDescriptions)
.onChange(async (value) => {
this.lazyPlugin.data.showDescriptions = value
await this.lazyPlugin.saveSettings()
this.display()
})
})
new Setting(containerEl)
.setName('Set the delay for all plugins at once')
.addDropdown(dropdown => {
Expand All @@ -133,16 +146,19 @@ export class SettingsTab extends PluginSettingTab {
await this.lazyPlugin.saveSettings()
})
})

new Setting(containerEl)
.setName('Plugins')
.setHeading()

// Add the delay settings for each installed plugin
this.lazyPlugin.manifests
.forEach(plugin => {
new Setting(containerEl)
.setName(plugin.name)
.setDesc(plugin.description)
.addDropdown(dropdown => {
this.dropdowns.push(dropdown)
this.addDelayOptions(dropdown)

dropdown
.setValue(this.lazyPlugin.getPluginStartup(plugin.id))
.onChange(async (value: LoadingMethod) => {
Expand All @@ -151,6 +167,12 @@ export class SettingsTab extends PluginSettingTab {
this.lazyPlugin.setPluginStartup(plugin.id).then()
})
})
.then(setting => {
if (this.lazyPlugin.data.showDescriptions) {
// Show or hide the plugin description depending on the user's choice
setting.setDesc(plugin.description)
}
})
})
}

Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"1.0.5": "1.6.0",
"1.0.6": "1.6.0",
"1.0.7": "1.6.0",
"1.0.9": "1.6.0"
"1.0.9": "1.6.0",
"1.0.10": "1.6.0"
}

0 comments on commit 077ed2e

Please sign in to comment.