mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
refactor: Improve sendWakatimeHeartBeat.
This commit is contained in:
@@ -120,14 +120,11 @@ export default class CodeEditor extends React.Component {
|
|||||||
const { storageKey, noteKey } = this.props
|
const { storageKey, noteKey } = this.props
|
||||||
const storage = findStorage(storageKey)
|
const storage = findStorage(storageKey)
|
||||||
if (storage)
|
if (storage)
|
||||||
sendWakatimeHeartBeat(
|
sendWakatimeHeartBeat(storage.path, noteKey, storage.name, {
|
||||||
storage.path,
|
isWrite: false,
|
||||||
noteKey,
|
hasFileChanges: false,
|
||||||
storage.name,
|
isFileChange: true
|
||||||
false,
|
})
|
||||||
false,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSearch(msg) {
|
handleSearch(msg) {
|
||||||
@@ -813,25 +810,17 @@ export default class CodeEditor extends React.Component {
|
|||||||
const storage = findStorage(storageKey)
|
const storage = findStorage(storageKey)
|
||||||
if (this.props.onChange) {
|
if (this.props.onChange) {
|
||||||
this.props.onChange(editor)
|
this.props.onChange(editor)
|
||||||
if (storage)
|
}
|
||||||
sendWakatimeHeartBeat(
|
|
||||||
storage.path,
|
const isWrite = !!this.props.onChange
|
||||||
noteKey,
|
const hasFileChanges = isWrite
|
||||||
storage.name,
|
|
||||||
true,
|
if (storage) {
|
||||||
true,
|
sendWakatimeHeartBeat(storage.path, noteKey, storage.name, {
|
||||||
false
|
isWrite,
|
||||||
)
|
hasFileChanges,
|
||||||
} else {
|
isFileChange: false
|
||||||
if (storage)
|
})
|
||||||
sendWakatimeHeartBeat(
|
|
||||||
storage.path,
|
|
||||||
noteKey,
|
|
||||||
storage.name,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -965,14 +954,11 @@ export default class CodeEditor extends React.Component {
|
|||||||
const { storageKey, noteKey } = this.props
|
const { storageKey, noteKey } = this.props
|
||||||
const storage = findStorage(storageKey)
|
const storage = findStorage(storageKey)
|
||||||
if (storage)
|
if (storage)
|
||||||
sendWakatimeHeartBeat(
|
sendWakatimeHeartBeat(storage.path, noteKey, storage.name, {
|
||||||
storage.path,
|
isWrite: false,
|
||||||
noteKey,
|
hasFileChanges: false,
|
||||||
storage.name,
|
isFileChange: true
|
||||||
false,
|
})
|
||||||
false,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setValue(value) {
|
setValue(value) {
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ function sendWakatimeHeartBeat(
|
|||||||
storagePath,
|
storagePath,
|
||||||
noteKey,
|
noteKey,
|
||||||
storageName,
|
storageName,
|
||||||
isWrite,
|
{ isWrite, hasFileChanges, isFileChange }
|
||||||
hasFileChanges,
|
|
||||||
isFileChange
|
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
config.get().wakatime.isActive &&
|
config.get().wakatime.isActive &&
|
||||||
|
|||||||
Reference in New Issue
Block a user