Skip to content

Commit

Permalink
feat(slack): add reading status
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidjaniga committed Feb 10, 2021
1 parent c6386da commit 5a69a10
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/app/src/api/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ async function changeStatus ({ text, emoji, expireTime }: Status) {
}
}

async function getStatus (): Promise<string> {
return slack.users.profile.get()
}

async function goIntoFocus (focusPhaseDurationInMinutes: number) {
try {
const pomodoroEndTime = addMinutes(new Date(), focusPhaseDurationInMinutes)
Expand Down Expand Up @@ -91,5 +95,13 @@ function getClient () {
return slack
}

const api = { goIntoFocus, endFocus, setToken, isInstalled, getId, getClient }
const api = {
goIntoFocus,
endFocus,
getStatus,
setToken,
isInstalled,
getId,
getClient
}
export default api
9 changes: 9 additions & 0 deletions packages/app/src/features/SlackInstalation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ const { shell } = window.require('electron')
const slackUserScopes = ['chat:write', 'dnd:write', 'users.profile:write'].join(
','
)

// @TODO: Plan in advance needed scopes, because on every scope change
// Slack App have to be authorized
// const slackUserScopes = [
// 'chat:write',
// 'dnd:write',
// 'users.profile:write',
// 'users.profile:read'
// ].join(',')
const slackClientId = '866674528645.977369566150'

class SlackTokenChecker extends React.Component<{
Expand Down

0 comments on commit 5a69a10

Please sign in to comment.