Skip to content

Commit

Permalink
feat: ✨ Support for turning off auto-check sync
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenull committed Aug 23, 2022
1 parent 7e22e9c commit a2ac2bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/helper/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ export const SETTINGS_SCHEMA: SettingSchemaDesc[] = [
default: true,
description: 'Check status when DB changed, restart logseq to take effect',
},
{
key: 'autoCheckSynced',
title: 'Auto Check If Synced',
type: 'boolean',
default: false,
description: 'Automatically check if the local version is the same as the remote',
},
{
key: 'autoPush',
title: 'Auto Push',
Expand Down
4 changes: 2 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ if (isDevelopment) {
})
}

checkIsSynced()
if (logseq.settings?.autoCheckSynced) checkIsSynced()
checkStatusWithDebounce()

if (top) {
top.document?.addEventListener('visibilitychange', async () => {
const visibilityState = top?.document?.visibilityState

if (visibilityState === 'visible') {
checkIsSynced()
if (logseq.settings?.autoCheckSynced) checkIsSynced()
} else if (visibilityState === 'hidden') {
// logseq.UI.showMsg(`Page is hidden: ${new Date()}`, 'success', { timeout: 0 })
// noChange void
Expand Down

0 comments on commit a2ac2bd

Please sign in to comment.