| 1882 | } |
| 1883 | |
| 1884 | enableCheckingFileStat() { |
| 1885 | this.app.workspace.onLayoutReady(() => { |
| 1886 | const t = (x: TransItemType, vars?: any) => { |
| 1887 | return this.i18n.t(x, vars); |
| 1888 | }; |
| 1889 | this.registerEvent( |
| 1890 | this.app.workspace.on("file-menu", (menu, file) => { |
| 1891 | if (file instanceof TFolder) { |
| 1892 | // folder not supported yet |
| 1893 | return; |
| 1894 | } |
| 1895 | |
| 1896 | menu.addItem((item) => { |
| 1897 | item |
| 1898 | .setTitle(t("menu_check_file_stat")) |
| 1899 | .setIcon("file-cog") |
| 1900 | .onClick(async () => { |
| 1901 | const filePath = file.path; |
| 1902 | const fsLocal = new FakeFsLocal( |
| 1903 | this.app.vault, |
| 1904 | this.settings.syncConfigDir ?? false, |
| 1905 | this.settings.syncBookmarks ?? false, |
| 1906 | this.app.vault.configDir, |
| 1907 | this.manifest.id, |
| 1908 | undefined, |
| 1909 | this.settings.deleteToWhere ?? "system" |
| 1910 | ); |
| 1911 | const s = await fsLocal.stat(filePath); |
| 1912 | new Notice(JSON.stringify(s, null, 2), 10000); |
| 1913 | }); |
| 1914 | }); |
| 1915 | }) |
| 1916 | ); |
| 1917 | }); |
| 1918 | } |
| 1919 | |
| 1920 | async saveAgreeToUseNewSyncAlgorithm() { |
| 1921 | this.settings.agreeToUseSyncV3 = true; |