Skip to content

Commit

Permalink
chore: add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
timeowilliams committed Nov 3, 2024
1 parent ac124c0 commit 661e83b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 109 deletions.
2 changes: 1 addition & 1 deletion latest-mac.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"url": "https://github.com/Tech-Nest-Ventures/deepFocus/releases/download/v.2.4.4/Deep.Focus.zip",
"url": "https://github.com/Tech-Nest-Ventures/deepFocus/releases/download/v2.4.4/Deep.Focus.zip",
"name": "2.4.4",
"notes": "Bug fixes and performance improvements.",
"pub_date": "2024-11-02T12:00:00Z"
Expand Down
106 changes: 0 additions & 106 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,110 +53,6 @@ export type DeepWorkHours = {
Saturday: number
Sunday: number
}

export type ExtendedResult = Result & { url?: string; siteTimeTracker?: SiteTimeTracker }

export type Options = {
/**
Enable the accessibility permission check. _(macOS)_
Setting this to `false` will prevent the accessibility permission prompt on macOS versions 10.15 and newer. The `url` property won't be retrieved.
@default true
*/
readonly accessibilityPermission: boolean

/**
Enable the screen recording permission check. _(macOS)_
Setting this to `false` will prevent the screen recording permission prompt on macOS versions 10.15 and newer. The `title` property in the result will always be set to an empty string.
@default true
*/
readonly screenRecordingPermission: boolean
}

export type BaseOwner = {
/**
Name of the app.
*/
name: string

/**
Process identifier
*/
processId: number

/**
Path to the app.
*/
path: string
}

export type BaseResult = {
/**
Window title.
*/
title: string

/**
Window identifier.
On Windows, there isn't a clear notion of a "Window ID". Instead it returns the memory address of the window "handle" in the `id` property. That "handle" is unique per window, so it can be used to identify them. [Read more…](https://msdn.microsoft.com/en-us/library/windows/desktop/ms632597(v=vs.85).aspx#window_handle).
*/
id: number

/**
Window position and size.
*/
bounds: {
x: number
y: number
width: number
height: number
}

/**
App that owns the window.
*/
owner: BaseOwner

/**
Memory usage by the window.
*/
memoryUsage: number
}

// eslint-disable-next-line @typescript-eslint/naming-convention
export type MacOSOwner = {
/**
Bundle identifier.
*/
bundleId: string
} & BaseOwner

// eslint-disable-next-line @typescript-eslint/naming-convention
export type MacOSResult = {
platform: 'macos'

owner: MacOSOwner

/**
URL of the active browser tab if the active window is Safari (includes Technology Preview), Chrome (includes Beta, Dev, and Canary), Edge (includes Beta, Dev, and Canary), Brave (includes Beta and Nightly), Mighty, Ghost Browser, WaveBox, Sidekick, Opera (includes Beta and Developer), or Vivaldi.
*/
url?: string
} & BaseResult

export type LinuxResult = {
platform: 'linux'
} & BaseResult

export type WindowsResult = {
platform: 'windows'
} & BaseResult

export type Result = MacOSResult | LinuxResult | WindowsResult

export interface ElectronAPI {
sendUserData: (user: {
username: string
Expand Down Expand Up @@ -184,8 +80,6 @@ export interface WorkContext {
value: string
}



export interface AppIcon {
appName: string
iconPath: string
Expand Down
9 changes: 7 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export function checkForUpdates(): void {
const server = 'https://raw.githubusercontent.com/Tech-Nest-Ventures/deepFocus/main'
const feedURL = `${server}/latest-mac.json`
autoUpdater.setFeedURL({ url: feedURL, serverType: 'json' })

log.info(autoUpdater.getFeedURL())
autoUpdater.checkForUpdates()

Expand All @@ -24,6 +25,10 @@ export function checkForUpdates(): void {
})
})

autoUpdater.on('checking-for-update', () => {
log.info('Checking for update...')
})

autoUpdater.on('update-not-available', () => {
log.info('No update available.')

Expand All @@ -45,8 +50,8 @@ export function checkForUpdates(): void {
})
})

autoUpdater.on('update-downloaded', async () => {
log.info('Update downloaded to:', autoUpdater.getFeedURL())
autoUpdater.on('update-downloaded', async (event, releaseNotes, releaseDate, updateURL) => {
log.info('Update downloaded to:', releaseNotes, releaseDate, updateURL)
const { response } = await dialog.showMessageBox({
type: 'info',
title: 'Install Update',
Expand Down

0 comments on commit 661e83b

Please sign in to comment.