Skip to content

Commit

Permalink
Merge pull request #8 from pullflow/ref/change-login-to-signin
Browse files Browse the repository at this point in the history
Refactor: Rename login and logout command to sign in and sign out
  • Loading branch information
hassan-pullflow authored Nov 7, 2023
2 parents a9c75a9 + f2a4e8b commit 9f6ff8f
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The **Pullflow VS Code extension** brings all your code review workflows and col
---

1. **Installation**: Install the “Pullflow” extension from the Visual Studio Marketplace or Open VSX Registry.
2. **Login**: Click on “Sign in to Pullflow” from the VS Code status bar.
2. **Sign in**: Click on “Sign in to Pullflow” from the VS Code status bar.
3. **Ready to use**: The extension is now ready to use ✨

## Key Features
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
"title": "Pullflow: Active Pull Requests"
},
{
"command": "pullflow.login",
"title": "Pullflow: Login"
"command": "pullflow.signIn",
"title": "Pullflow: Sign in"
},
{
"command": "pullflow.logout",
"title": "Pullflow: Logout"
"command": "pullflow.signOut",
"title": "Pullflow: Sign out"
},
{
"command": "pullflow.reconnect",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/reconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const Reconnect = async (
if (codeReviews.requireRelogin) {
log.error(codeReviews.error, module)
window.showInformationMessage(`Pullflow: Please login again`)
commands.executeCommand(Command.logout)
commands.executeCommand(Command.signOut)
return
}

Expand Down
6 changes: 3 additions & 3 deletions src/commands/login.ts → src/commands/signIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { initialize } from '../utils/initialize'

const SIGN_IN_TIME_OUT = 120000 // sign in time out in ms

export const Login = async ({
export const SignIn = async ({
context,
statusBar,
}: {
context: ExtensionContext
statusBar: StatusBarItem
}) => {
const redirectUri = `${env.uriScheme}://${context.extension.packageJSON.publisher}.${context.extension.packageJSON.name}`
const loginUrl = AppConfig.pullflow.baseUrl
const signInUrl = AppConfig.pullflow.baseUrl

env.openExternal(
Uri.parse(
`${loginUrl}/?clientIdentifier=${AppConfig.app.clientIdentifier}&clientUri=${redirectUri}`
`${signInUrl}/?clientIdentifier=${AppConfig.app.clientIdentifier}&clientUri=${redirectUri}`
)
)
const user = await Authorization.waitForUser(context, SIGN_IN_TIME_OUT)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/logout.ts → src/commands/signOut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StatusBar } from '../views/statusBar/statusBar'
import { StatusBarState } from '../utils'
import { Store } from '../utils/store'

export const Logout = async ({
export const SignOut = async ({
context,
statusBar,
pollIntervalId,
Expand Down
12 changes: 7 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ExtensionContext, commands, StatusBarItem, window, Uri } from 'vscode'
import { log } from './utils/logger'
import { Login } from './commands/login'
import { SignIn } from './commands/signIn'
import { StatusBar } from './views/statusBar/statusBar'
import { Command } from './utils'
import { initialize } from './utils/initialize'
import { Store } from './utils/store'
import { Reconnect } from './commands/reconnect'
import { Logout } from './commands/logout'
import { SignOut } from './commands/signOut'
import { ActivePullRequests } from './commands/activePullRequests'
import { Authorization } from './utils/authorization'
import { ToggleFlowState } from './commands/toggleFlowState'
Expand Down Expand Up @@ -44,11 +44,13 @@ export async function activate(context: ExtensionContext) {
})

context.subscriptions.push(
commands.registerCommand(Command.login, () => Login({ context, statusBar }))
commands.registerCommand(Command.signIn, () =>
SignIn({ context, statusBar })
)
)
context.subscriptions.push(
commands.registerCommand(Command.logout, () =>
Logout({
commands.registerCommand(Command.signOut, () =>
SignOut({
context,
statusBar,
pollIntervalId,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/commands.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const Command = {
login: 'pullflow.login',
signIn: 'pullflow.signIn',
activePullRequests: 'pullflow.active-pull-requests',
logout: 'pullflow.logout',
signOut: 'pullflow.signOut',
reconnect: 'pullflow.reconnect',
toggleFlowState: 'pullflow.toggle-flow-state',
welcomeView: 'pullflow.welcome-view',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const setSpaceUsers = async ({
window.showInformationMessage(
`Error in fetching space users ${spaceUsers.error || spaceUsers.message}`
)
commands.executeCommand(Command.logout)
commands.executeCommand(Command.signOut)
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/pullRequestsState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const PullRequestState = {
if (codeReviews.requireRelogin) {
log.error(codeReviews.error, module)
window.showInformationMessage(`Pullflow: Please login again`)
commands.executeCommand(Command.logout)
commands.executeCommand(Command.signOut)
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/statusBar/statusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const statusBarProperties = {
tooltip: 'Pullflow - Active Pull Requests',
},
signedOut: {
command: Command.login,
command: Command.signIn,
backgroundColor: new ThemeColor(Theme.statusBar.error),
text: '⚠ Sign in to Pullflow',
tooltip: 'Sign in to Pullflow account',
Expand Down
4 changes: 2 additions & 2 deletions src/views/webviews/welcome/welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ export const Welcome = {
<td>Pullflow: Active Pull Requests (Ctrl/Cmd+Shift+,)</td>
</tr>
<tr>
<td>Pullflow: Login</td>
<td>Pullflow: Sign in</td>
</tr>
<tr>
<td>Pullflow: Logout</td>
<td>Pullflow: Sign out</td>
</tr>
<tr>
<td>Pullflow: Reconnect</td>
Expand Down

0 comments on commit 9f6ff8f

Please sign in to comment.