Implemented option to open submodule in a new tab
This commit is contained in:
parent
63df04e3ba
commit
4978af23d8
2 changed files with 7 additions and 2 deletions
|
@ -6,6 +6,7 @@ import com.jetpackduba.gitnuro.AppStateManager
|
||||||
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
|
import com.jetpackduba.gitnuro.credentials.CredentialsStateManager
|
||||||
import com.jetpackduba.gitnuro.di.modules.AppModule
|
import com.jetpackduba.gitnuro.di.modules.AppModule
|
||||||
import com.jetpackduba.gitnuro.preferences.AppSettings
|
import com.jetpackduba.gitnuro.preferences.AppSettings
|
||||||
|
import com.jetpackduba.gitnuro.ui.TabsManager
|
||||||
import com.jetpackduba.gitnuro.viewmodels.SettingsViewModel
|
import com.jetpackduba.gitnuro.viewmodels.SettingsViewModel
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -25,4 +26,6 @@ interface AppComponent {
|
||||||
fun appPreferences(): AppSettings
|
fun appPreferences(): AppSettings
|
||||||
|
|
||||||
fun appEnvInfo(): AppEnvInfo
|
fun appEnvInfo(): AppEnvInfo
|
||||||
|
|
||||||
|
fun tabsManager(): TabsManager
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import com.jetpackduba.gitnuro.git.TabState
|
||||||
import com.jetpackduba.gitnuro.git.submodules.GetSubmodulesUseCase
|
import com.jetpackduba.gitnuro.git.submodules.GetSubmodulesUseCase
|
||||||
import com.jetpackduba.gitnuro.git.submodules.InitializeSubmoduleUseCase
|
import com.jetpackduba.gitnuro.git.submodules.InitializeSubmoduleUseCase
|
||||||
import com.jetpackduba.gitnuro.git.submodules.UpdateSubmoduleUseCase
|
import com.jetpackduba.gitnuro.git.submodules.UpdateSubmoduleUseCase
|
||||||
|
import com.jetpackduba.gitnuro.ui.TabsManager
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
@ -20,6 +21,7 @@ class SubmodulesViewModel @AssistedInject constructor(
|
||||||
private val initializeSubmoduleUseCase: InitializeSubmoduleUseCase,
|
private val initializeSubmoduleUseCase: InitializeSubmoduleUseCase,
|
||||||
private val updateSubmoduleUseCase: UpdateSubmoduleUseCase,
|
private val updateSubmoduleUseCase: UpdateSubmoduleUseCase,
|
||||||
private val tabScope: CoroutineScope,
|
private val tabScope: CoroutineScope,
|
||||||
|
private val tabsManager: TabsManager,
|
||||||
@Assisted
|
@Assisted
|
||||||
private val filter: StateFlow<String>,
|
private val filter: StateFlow<String>,
|
||||||
) : SidePanelChildViewModel(true) {
|
) : SidePanelChildViewModel(true) {
|
||||||
|
@ -70,8 +72,8 @@ class SubmodulesViewModel @AssistedInject constructor(
|
||||||
loadSubmodules(git)
|
loadSubmodules(git)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onOpenSubmoduleInTab(@Suppress("UNUSED_PARAMETER") path: String) {
|
fun onOpenSubmoduleInTab(path: String) = tabState.runOperation(refreshType = RefreshType.NONE) { git ->
|
||||||
TODO()
|
tabsManager.addNewTabFromPath("${git.repository.directory.parent}/$path", true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue