-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to webview-based sign-in flow #2382
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,18 +5,14 @@ | |
import com.intellij.notification.Notifications; | ||
import com.intellij.openapi.actionSystem.AnAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.application.ApplicationManager; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.wm.ToolWindow; | ||
import com.intellij.openapi.wm.ToolWindowManager; | ||
import com.sourcegraph.Icons; | ||
import com.sourcegraph.cody.CodyToolWindowFactory; | ||
import com.sourcegraph.cody.config.CodyAccount; | ||
import com.sourcegraph.cody.config.CodyAccountManager; | ||
import com.sourcegraph.cody.auth.CodyAccount; | ||
import com.sourcegraph.cody.config.CodyApplicationSettings; | ||
import com.sourcegraph.cody.config.CodyAuthenticationManager; | ||
import com.sourcegraph.cody.initialization.Activity; | ||
import com.sourcegraph.cody.statusbar.CodyManageAccountsAction; | ||
import com.sourcegraph.common.NotificationGroups; | ||
import com.sourcegraph.common.ui.DumbAwareEDTAction; | ||
import org.jetbrains.annotations.NotNull; | ||
|
@@ -25,19 +21,8 @@ public class CodyAuthNotificationActivity implements Activity { | |
|
||
@Override | ||
public void runActivity(@NotNull Project project) { | ||
CodyAccount activeAccount = CodyAuthenticationManager.getInstance().getAccount(); | ||
CodyAccountManager service = | ||
ApplicationManager.getApplication().getService(CodyAccountManager.class); | ||
|
||
if (activeAccount != null) { | ||
String token = service.findCredentials(activeAccount); | ||
if (token == null) { | ||
showMissingTokenNotification(); | ||
} | ||
} | ||
|
||
if (!CodyApplicationSettings.getInstance().isGetStartedNotificationDismissed() | ||
&& activeAccount == null) { | ||
&& !CodyAccount.Companion.hasActiveAccount()) { | ||
showOpenCodySidebarNotification(project); | ||
} | ||
} | ||
|
@@ -79,15 +64,4 @@ public void actionPerformed(@NotNull AnActionEvent anActionEvent) { | |
notification.addAction(neverShowAgainAction); | ||
Notifications.Bus.notify(notification); | ||
} | ||
|
||
private void showMissingTokenNotification() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw, I wonder... what if the token expires (or is removed)? 🤔 what will happen (with chat, with autocomplete)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will test this scenario today. In general I think we should then (if user try to call some action explicitly) show cody panel, and it should be showing login panel. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, VSCode has various APIs for showing views, we don't implement them. If we need to show the view, we should see if the extension is trying to do it anyway. Maybe we just need to implement a couple of those methods/properties in the VSCode shim. |
||
// Display notification | ||
Notification notification = | ||
new Notification( | ||
NotificationGroups.CODY_AUTH, "Missing access token", "", NotificationType.WARNING); | ||
|
||
notification.setIcon(Icons.CodyLogo); | ||
notification.addAction(new CodyManageAccountsAction()); | ||
Notifications.Bus.notify(notification); | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this is not an item for this PR but our settings seems to be orphaned now 😢 Can we still have them under
Tools > Sourcegraph & Cody
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting it!
It is definitely for this PR, in fact I removed too much (update channel selection).
I added it back now.