Disabling PDF indexing on mobile to avoid a crash

This commit is contained in:
Simon Cambier
2022-10-13 08:36:35 +02:00
parent 342cdabdd9
commit 0381d1918b

View File

@@ -1,4 +1,10 @@
import { Plugin, PluginSettingTab, Setting, SliderComponent } from 'obsidian' import {
Platform,
Plugin,
PluginSettingTab,
Setting,
SliderComponent,
} from 'obsidian'
import { writable } from 'svelte/store' import { writable } from 'svelte/store'
import { notesCacheFilePath, minisearchCacheFilePath } from './globals' import { notesCacheFilePath, minisearchCacheFilePath } from './globals'
import type OmnisearchPlugin from './main' import type OmnisearchPlugin from './main'
@@ -167,7 +173,8 @@ export class SettingsTab extends PluginSettingTab {
}) })
) )
// PDF Indexing // PDF Indexing - not available on mobile
if (!Platform.isMobileApp) {
const indexPDFsDesc = new DocumentFragment() const indexPDFsDesc = new DocumentFragment()
indexPDFsDesc.createSpan({}, span => { indexPDFsDesc.createSpan({}, span => {
span.innerHTML = `Omnisearch will include PDFs in search results. span.innerHTML = `Omnisearch will include PDFs in search results.
@@ -184,7 +191,7 @@ export class SettingsTab extends PluginSettingTab {
await saveSettings(this.plugin) await saveSettings(this.plugin)
}) })
) )
}
// #endregion Behavior // #endregion Behavior
// #region User Interface // #region User Interface
@@ -330,7 +337,9 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = {
ignoreDiacritics: true, ignoreDiacritics: true,
indexedFileTypes: [] as string[], indexedFileTypes: [] as string[],
PDFIndexing: false, PDFIndexing: false,
backgroundProcesses: Math.max(1, Math.floor(require('os').cpus().length / 2)), backgroundProcesses: Platform.isMobileApp
? 0
: Math.max(1, Math.floor(require('os').cpus().length / 2)),
showIndexingNotices: false, showIndexingNotices: false,
showShortName: false, showShortName: false,