Skip to content
This repository was archived by the owner on Oct 24, 2021. It is now read-only.

Commit 2046878

Browse files
committed
Updated handleLogin to use BrowserUtil#browse
1 parent 40df1f5 commit 2046878

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ jobs:
3838
- name: Upload Artifacts
3939
uses: actions/upload-artifact@v2
4040
with:
41-
name: Artifacts.zip
41+
name: Artifacts
4242
path: build/distributions

src/main/kotlin/dev/koding/copilot/auth/OAuthHandler.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
package dev.koding.copilot.auth
44

55
import com.google.gson.annotations.SerializedName
6+
import com.intellij.ide.BrowserUtil
67
import dev.koding.copilot.config.settings
78
import dev.koding.copilot.httpClient
89
import dev.koding.copilot.util.Notifications
910
import io.ktor.client.request.*
1011
import io.ktor.http.*
1112
import kotlinx.coroutines.GlobalScope
1213
import kotlinx.coroutines.launch
13-
import java.awt.Desktop
14-
import java.net.URI
1514
import javax.swing.JOptionPane
1615

1716
const val authenticateUrl = "https://vscode-auth.github.com/authorize/" +
@@ -48,7 +47,7 @@ private suspend fun getAuthToken(url: String): CopilotTokenResponse {
4847
}
4948

5049
fun handleLogin(handler: (String) -> Unit = { Notifications.send("Login successful") }) {
51-
Desktop.getDesktop().browse(URI.create(authenticateUrl))
50+
BrowserUtil.browse(authenticateUrl)
5251
val url = JOptionPane.showInputDialog("Enter the callback URL")
5352

5453
// TODO: Change from global scope

0 commit comments

Comments
 (0)