Skip to content

Commit

Permalink
Reroute to Login if not authenticated for chat
Browse files Browse the repository at this point in the history
  • Loading branch information
angjordn committed Sep 17, 2024
1 parent fbb6855 commit 503f7f5
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import jakarta.inject.Inject;
import software.aws.toolkits.eclipse.amazonq.lsp.manager.LspConstants;
import software.aws.toolkits.eclipse.amazonq.util.AuthUtils;
import software.aws.toolkits.eclipse.amazonq.util.PluginUtils;
import software.aws.toolkits.eclipse.amazonq.util.ThreadingUtils;

public class AmazonQChatWebview extends AmazonQView {

Expand All @@ -39,7 +41,9 @@ public AmazonQChatWebview() {
public final void createPartControl(final Composite parent) {
setupAmazonQView(parent, true);

browser.setText(getContent());
AuthUtils.isLoggedIn().thenAcceptAsync(isLoggedIn -> {
handleAuthStatusChange(isLoggedIn);
}, ThreadingUtils::executeAsyncTask);

BrowserFunction prefsFunction = new OpenPreferenceFunction(browser, "openEclipsePreferences", this::openPreferences);
browser.addDisposeListener(e -> prefsFunction.dispose());
Expand Down

0 comments on commit 503f7f5

Please sign in to comment.