Skip to content

Commit

Permalink
refactor: rename copy to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
will-stone committed Jan 2, 2022
1 parent 884502b commit c6b3833
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/state/middleware.action-hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type { Middleware } from '../../shared/state/model'
import type { RootState } from '../../shared/state/reducer.root'
import { database } from '../database'
import { createTray, tray } from '../tray'
import copyToClipboard from '../utils/copy-to-clipboard'
import copyUrlToClipboard from '../utils/copy-url-to-clipboard'
import { getInstalledAppIds } from '../utils/get-installed-app-ids'
import { initUpdateChecker } from '../utils/init-update-checker'
import { openApp } from '../utils/open-app'
Expand Down Expand Up @@ -100,7 +100,7 @@ export const actionHubMiddleware =

// Clicked URL bar
else if (clickedUrlBar.match(action)) {
if (copyToClipboard(nextState.data.url)) {
if (copyUrlToClipboard(nextState.data.url)) {
pickerWindow?.hide()
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@ export const actionHubMiddleware =
}
// Copy key
else if (action.payload.metaKey && action.payload.virtualKey === 'c') {
if (copyToClipboard(nextState.data.url)) {
if (copyUrlToClipboard(nextState.data.url)) {
pickerWindow?.hide()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { clipboard } from 'electron'

import copyToClipboard from './copy-to-clipboard'
import copyUrlToClipboard from './copy-url-to-clipboard'

jest.mock('child_process')

test('should copy string', () => {
copyToClipboard('string')
copyUrlToClipboard('string')
expect(clipboard.readText()).toBe('string')
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { clipboard, Notification } from 'electron'

const copyToClipboard = (string: string): boolean => {
const copyUrlToClipboard = (string: string): boolean => {
if (string) {
clipboard.writeText(string)
new Notification({
Expand All @@ -14,4 +14,4 @@ const copyToClipboard = (string: string): boolean => {
return false
}

export default copyToClipboard
export default copyUrlToClipboard

0 comments on commit c6b3833

Please sign in to comment.