Skip to content

Commit

Permalink
Add mode to the notification (#180977)
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerLeonhardt authored Apr 26, 2023
1 parent 74d91b8 commit 738ab79
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions extensions/github-authentication/src/githubServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ export class GitHubServer implements IGitHubServer {
let userCancelled: boolean | undefined;
const yes = vscode.l10n.t('Yes');
const no = vscode.l10n.t('No');
const promptToContinue = async () => {
const promptToContinue = async (mode: string) => {
if (userCancelled === undefined) {
// We haven't had a failure yet so wait to prompt
return;
}
const message = userCancelled
? vscode.l10n.t('Having trouble logging in? Would you like to try a different way?')
: vscode.l10n.t('You have not yet finished authorizing this extension to use GitHub. Would you like to keep trying?');
? vscode.l10n.t('Having trouble logging in? Would you like to try a different way? ({0})', mode)
: vscode.l10n.t('You have not yet finished authorizing this extension to use GitHub. Would you like to try a different way? ({0})', mode);
const result = await vscode.window.showWarningMessage(message, yes, no);
if (result !== yes) {
throw new Error(CANCELLATION_ERROR);
Expand Down Expand Up @@ -167,7 +167,7 @@ export class GitHubServer implements IGitHubServer {
supportedTarget
) {
try {
await promptToContinue();
await promptToContinue(vscode.l10n.t('local server'));
return await this.doLoginWithLocalServer(scopes);
} catch (e) {
userCancelled = this.processLoginError(e);
Expand All @@ -177,7 +177,7 @@ export class GitHubServer implements IGitHubServer {
// We only can use the Device Code flow when we have a full node environment because of CORS.
if (typeof navigator === 'undefined') {
try {
await promptToContinue();
await promptToContinue(vscode.l10n.t('device code'));
return await this.doLoginDeviceCodeFlow(scopes);
} catch (e) {
userCancelled = this.processLoginError(e);
Expand All @@ -188,7 +188,7 @@ export class GitHubServer implements IGitHubServer {
// With that said, GitHub Enterprise isn't used by Settings Sync so we can use PATs for that.
if (!supportedClient || this._type === AuthProviderType.githubEnterprise) {
try {
await promptToContinue();
await promptToContinue(vscode.l10n.t('personal access token'));
return await this.doLoginWithPat(scopes);
} catch (e) {
userCancelled = this.processLoginError(e);
Expand Down

0 comments on commit 738ab79

Please sign in to comment.