Skip to content

Commit

Permalink
Fix class initialization dependent on service
Browse files Browse the repository at this point in the history
fix: #6165
  • Loading branch information
YiiGuxing committed Nov 10, 2024
1 parent 97b47fe commit 9b551bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ internal class ReportSubmitter : ErrorReportSubmitter() {

private fun requestNewCredentials(project: Project?, parentComponent: JComponent?) {
val (user, token) = try {
TranslationGitHubAppService.instance.auth(project, parentComponent as JComponent) ?: return
TranslationGitHubAppService.auth(project, parentComponent as JComponent) ?: return
} catch (e: Exception) {
LOG.w("Failed to request new credentials", e)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,16 @@ package cn.yiiguxing.plugin.translate.diagnostic.github
import cn.yiiguxing.plugin.translate.diagnostic.github.auth.*
import cn.yiiguxing.plugin.translate.message
import cn.yiiguxing.plugin.translate.util.Application
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.intellij.util.concurrency.annotations.RequiresEdt
import javax.swing.JComponent


@Service
internal class TranslationGitHubAppService private constructor() {
internal object TranslationGitHubAppService {

companion object {
private const val CLIENT_ID = "e8a353548fe014bb27de"
private const val CLIENT_ID = "e8a353548fe014bb27de"

private val SCOPES: Array<out String> = arrayOf("public_repo")

val instance: TranslationGitHubAppService = service()
}
private val SCOPES: Array<out String> = arrayOf("public_repo")


@RequiresEdt
Expand Down

0 comments on commit 9b551bd

Please sign in to comment.