generated from JetBrains/intellij-platform-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
51 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 11 additions & 12 deletions
23
src/main/kotlin/com/dsoftware/ghmanager/data/GhActionsService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
package com.dsoftware.ghmanager.data | ||
|
||
import com.dsoftware.ghmanager.ui.settings.GhActionsSettingsService | ||
import com.intellij.collaboration.auth.Account | ||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.project.Project | ||
import git4idea.remote.GitRemoteUrlCoordinates | ||
import git4idea.remote.hosting.knownRepositories | ||
import kotlinx.coroutines.flow.StateFlow | ||
import org.jetbrains.plugins.github.authentication.accounts.GHAccountManager | ||
import org.jetbrains.plugins.github.authentication.accounts.GithubAccount | ||
import org.jetbrains.plugins.github.util.GHGitRepositoryMapping | ||
import org.jetbrains.plugins.github.util.GHHostedRepositoriesManager | ||
import org.jetbrains.plugins.github.util.LazyCancellableBackgroundProcessValue | ||
|
||
@Service(Service.Level.PROJECT) | ||
class GhActionsService(project: Project) { | ||
interface GhActionsService { | ||
val knownRepositoriesState: StateFlow<Set<GHGitRepositoryMapping>> | ||
val knownRepositories: Set<GHGitRepositoryMapping> | ||
val accountsState: StateFlow<Collection<GithubAccount>> | ||
} | ||
|
||
val repositoriesManager = project.service<GHHostedRepositoriesManager>() | ||
val accountManager = service<GHAccountManager>() | ||
open class GhActionsServiceImpl(project: Project) : GhActionsService { | ||
private val repositoriesManager = project.service<GHHostedRepositoriesManager>() | ||
private val accountManager = service<GHAccountManager>() | ||
|
||
val knownRepositoriesState: kotlinx.coroutines.flow.StateFlow<Set<org.jetbrains.plugins.github.util.GHGitRepositoryMapping>> | ||
override val knownRepositoriesState: StateFlow<Set<GHGitRepositoryMapping>> | ||
get() = repositoriesManager.knownRepositoriesState | ||
val knownRepositories: Set<GHGitRepositoryMapping> | ||
override val knownRepositories: Set<GHGitRepositoryMapping> | ||
get() = repositoriesManager.knownRepositories | ||
val accountsState: StateFlow<Collection<GithubAccount>> | ||
override val accountsState: StateFlow<Collection<GithubAccount>> | ||
get() = accountManager.accountsState | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters