Skip to content

Commit

Permalink
fix: add release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed May 11, 2023
1 parent 33fc122 commit 33b37ca
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,20 @@ const main = async (baseInfo: LSPluginBaseInfo) => {
console.log('logseq-omnivore loaded')

logseq.useSettingsSchema(await settingsSchema())
// update version if needed
const latestVersion = baseInfo.version as string
const currentVersion = (logseq.settings as Settings).version
if (latestVersion !== currentVersion) {
logseq.updateSettings({ version: latestVersion })
// show release notes
const releaseNotes = `Omnivore plugin is upgraded to ${latestVersion}.
What's new: https://github.com/omnivore-app/logseq-omnivore/blob/main/CHANGELOG.md
`
await logseq.UI.showMsg(releaseNotes, 'success', {
timeout: 10000,
})
}

logseq.onSettingsChanged((newSettings: Settings, oldSettings: Settings) => {
const newFrequency = newSettings.frequency
Expand Down
15 changes: 15 additions & 0 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface Settings {
syncJobId: number
endpoint: string
isSinglePage: boolean
version: string
}

export const getQueryFromFilter = (
Expand All @@ -47,6 +48,13 @@ export const getQueryFromFilter = (
}

export const settingsSchema = async (): Promise<SettingSchemaDesc[]> => [
{
key: 'generalSettings',
type: 'heading',
title: 'General Settings',
default: '',
description: '',
},
{
key: 'apiKey',
type: 'string',
Expand Down Expand Up @@ -141,6 +149,13 @@ export const settingsSchema = async (): Promise<SettingSchemaDesc[]> => [
default: defaultHighlightTemplate,
inputAs: 'textarea',
},
{
key: 'advancedSettings',
type: 'heading',
title: 'Advanced Settings',
default: '',
description: '',
},
{
key: 'endpoint',
type: 'string',
Expand Down

0 comments on commit 33b37ca

Please sign in to comment.