Skip to content

Commit

Permalink
fix: recognize unproductive apps
Browse files Browse the repository at this point in the history
  • Loading branch information
timeowilliams committed Nov 6, 2024
1 parent 33ae9cb commit 824b654
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/productivityUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TypedStore } from './main'
import { exec } from 'child_process'
import dayjs from 'dayjs'
import log from 'electron-log/node.js'
import path from 'path'
import path, { format } from 'path'
import { app } from 'electron'
import fs from 'fs'

Expand Down Expand Up @@ -180,13 +180,13 @@ export function isDeepWork(context: WorkContext, store: TypedStore): boolean {
}
} else if (context.type === 'appName') {
const unproductiveApps: unknown = store.get('unproductiveApps', [])

const validUnproductiveApps: AppIcon[] =
Array.isArray(unproductiveApps) &&
unproductiveApps.every((item) => typeof item === 'object' && 'name' in item)
unproductiveApps.every((item) => typeof item === 'object' && 'appName' in item)
? (unproductiveApps as AppIcon[])
: []

console.log(formattedItem)
console.log(validUnproductiveApps.map((app) => app.appName))
if (validUnproductiveApps.some((app) => formattedItem.includes(app.appName.toLowerCase()))) {
console.log('Unproductive app detected:', formattedItem)
return false
Expand Down

0 comments on commit 824b654

Please sign in to comment.