Skip to content

Commit

Permalink
fix: show release notes after upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed May 12, 2023
1 parent c41bc8f commit 37382a2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
15 changes: 15 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ export default class OmnivorePlugin extends Plugin {
async onload() {
await this.loadSettings();
await this.resetSyncingStateSetting();

// update version if needed
const latestVersion = this.manifest.version;
const currentVersion = this.settings.version;
if (latestVersion !== currentVersion) {
this.settings.version = latestVersion;
this.saveSettings();
// show release notes
const releaseNotes = `Omnivore plugin is upgraded to ${latestVersion}.
What's new: https://github.com/omnivore-app/obsidian-omnivore/blob/main/CHANGELOG.md
`;
new Notice(releaseNotes, 10000);
}

this.addCommand({
id: "sync",
name: "Sync",
Expand Down
2 changes: 2 additions & 0 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const DEFAULT_SETTINGS: OmnivoreSettings = {
endpoint: "https://api-prod.omnivore.app/api/graphql",
filename: "{{{title}}}",
attachmentFolder: "Omnivore/attachments",
version: "0.0.0",
};

export enum Filter {
Expand Down Expand Up @@ -43,4 +44,5 @@ export interface OmnivoreSettings {
dateSavedFormat: string;
filename: string;
attachmentFolder: string;
version: string;
}
38 changes: 19 additions & 19 deletions src/settings/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,24 @@ export interface HighlightView {

export type ArticleView =
| {
id: string;
title: string;
omnivoreUrl: string;
siteName: string;
originalUrl: string;
author?: string;
labels?: LabelView[];
dateSaved: string;
highlights: HighlightView[];
content: string;
datePublished?: string;
fileAttachment?: string;
description?: string;
note?: string;
type: PageType;
dateRead?: string;
wordsCount?: number;
readLength?: number;
id: string;
title: string;
omnivoreUrl: string;
siteName: string;
originalUrl: string;
author?: string;
labels?: LabelView[];
dateSaved: string;
highlights: HighlightView[];
content: string;
datePublished?: string;
fileAttachment?: string;
description?: string;
note?: string;
type: PageType;
dateRead?: string;
wordsCount?: number;
readLength?: number;
state: string;
}
| FunctionMap;
Expand All @@ -100,7 +100,7 @@ enum ArticleState {
const getArticleState = (article: Article): string => {
if (article.isArchived) {
return ArticleState.Archived;
}
}
if (article.readingProgressPercent > 0) {
return article.readingProgressPercent === 100
? ArticleState.Completed
Expand Down

0 comments on commit 37382a2

Please sign in to comment.