diff --git a/src/main.ts b/src/main.ts index b483354a..f8bca3d8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import { Plugin, MenuItem, TFile, WorkspaceLeaf, requireApiVersion } from 'obsidian'; +import { Plugin, MenuItem, TFile, WorkspaceLeaf, requireApiVersion, Notice } from 'obsidian'; import { ExplorerLeaf, ExplorerView } from './@types/obsidian'; import { createDefaultDirectory, initIconPacks, loadUsedIcons, setPath } from './iconPackManager'; import IconsPickerModal, { Icon } from './iconsPickerModal'; @@ -31,10 +31,24 @@ export default class IconFolderPlugin extends Plugin { if (!this.getSettings().migrated) { console.log('migrating icons...'); this.data = migrateIcons(this); - this.getSettings().migrated = true; + this.getSettings().migrated++; console.log('...icons migrated'); } + // @ts-ignore + if (this.getSettings().migrated === true) { + this.getSettings().migrated = 1; + } + + // Migration for new syncing mechanism. + if (this.getSettings().migrated === 1) { + new Notice( + 'Please delete your old icon packs and redownload your icon packs to use the new syncing mechanism.', + 20000, + ); + this.getSettings().migrated++; + } + const extraPadding = (this.getSettings() as any).extraPadding as ExtraMarginSettings; if (extraPadding) { if (extraPadding.top !== 2 || extraPadding.bottom !== 2 || extraPadding.left !== 2 || extraPadding.right !== 2) { diff --git a/src/settings/data.ts b/src/settings/data.ts index 275713f8..d6085bad 100644 --- a/src/settings/data.ts +++ b/src/settings/data.ts @@ -13,7 +13,7 @@ export interface CustomRule { } export interface IconFolderSettings { - migrated: boolean; + migrated: number; iconPacksPath: string; fontSize: number; emojiStyle: 'none' | 'native' | 'twemoji'; @@ -26,7 +26,7 @@ export interface IconFolderSettings { } export const DEFAULT_SETTINGS: IconFolderSettings = { - migrated: false, + migrated: 1, iconPacksPath: '.obsidian/plugins/obsidian-icon-folder/icons', fontSize: 16, emojiStyle: 'none',