Skip to content

Commit

Permalink
Revert "adding temp code"
Browse files Browse the repository at this point in the history
This reverts commit 933fe8c.
  • Loading branch information
KevinSchildhorn committed Oct 11, 2024
1 parent 933fe8c commit b8e51af
Show file tree
Hide file tree
Showing 20 changed files with 65 additions and 304 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import com.kevinschildhorn.fotopresenter.startKoin
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModelTwo
import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.slideshow.SlideshowViewModel
Expand All @@ -16,7 +15,7 @@ import org.koin.core.component.KoinComponent
class MainActivity : AppCompatActivity(), KoinComponent {

private val loginViewModel by viewModel<LoginViewModel>()
private val directoryViewModel by viewModel<DirectoryViewModelTwo>()
private val directoryViewModel by viewModel<DirectoryViewModel>()
private val slideshowViewModel by viewModel<SlideshowViewModel>()
private val playlistViewModel by viewModel<PlaylistViewModel>()

Expand Down
17 changes: 2 additions & 15 deletions desktopApp/src/jvmMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import androidx.compose.ui.window.application
import co.touchlab.kermit.Logger
import com.kevinschildhorn.fotopresenter.UseCaseFactory
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModelTwo
import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.slideshow.SlideshowViewModel
Expand All @@ -13,19 +12,7 @@ object KoinPurse {
val loginViewModel =
LoginViewModel(Logger.withTag("LoginViewModel"), UseCaseFactory.credentialsRepository)
val directoryViewModel =
DirectoryViewModel(
UseCaseFactory.playlistRepository,
Logger.withTag("DirectoryViewModel"),
UseCaseFactory.directoryRepository,
UseCaseFactory.directoryEtc,
)
val directoryViewModelTwo =
DirectoryViewModelTwo(
UseCaseFactory.playlistRepository,
Logger.withTag("DirectoryViewModel"),
UseCaseFactory.directoryRepository,
UseCaseFactory.directoryEtc,
)
DirectoryViewModel(UseCaseFactory.playlistRepository, Logger.withTag("DirectoryViewModel"))
val slideshowViewModel = SlideshowViewModel(Logger.withTag("SlideshowViewModel"))
val playlistViewModel =
PlaylistViewModel(UseCaseFactory.playlistRepository, Logger.withTag("PlaylistViewModel"))
Expand All @@ -38,7 +25,7 @@ fun main() = application {
) {
MainView(
KoinPurse.loginViewModel,
KoinPurse.directoryViewModelTwo,
KoinPurse.directoryViewModel,
KoinPurse.slideshowViewModel,
KoinPurse.playlistViewModel,
)
Expand Down
3 changes: 1 addition & 2 deletions shared/src/androidMain/kotlin/Main.android.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import androidx.compose.runtime.Composable
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModelTwo
import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.slideshow.SlideshowViewModel
Expand All @@ -10,7 +9,7 @@ actual fun getPlatformName(): String = "Android"
@Composable
fun MainView(
loginViewModel: LoginViewModel,
directoryViewModel: DirectoryViewModelTwo,
directoryViewModel: DirectoryViewModel,
slideshowViewModel: SlideshowViewModel,
playlistViewModel: PlaylistViewModel,
) = App(loginViewModel, directoryViewModel, slideshowViewModel, playlistViewModel)
5 changes: 2 additions & 3 deletions shared/src/commonMain/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.kevinschildhorn.fotopresenter.ui.atoms.fotoShapes
import com.kevinschildhorn.fotopresenter.ui.screens.common.Screen
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryScreen
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModelTwo
import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginScreen
import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistScreen
Expand All @@ -26,7 +25,7 @@ import com.kevinschildhorn.fotopresenter.ui.screens.slideshow.SlideshowViewModel
@Composable
fun App(
loginViewModel: LoginViewModel,
directoryViewModel: DirectoryViewModelTwo,
directoryViewModel: DirectoryViewModel,
slideshowViewModel: SlideshowViewModel,
playlistViewModel: PlaylistViewModel,
navController: NavHostController = rememberNavController()
Expand Down Expand Up @@ -57,7 +56,7 @@ fun App(
},
onStartSlideshow = {
slideshowViewModel.setSlideshow(it)
//directoryViewModel.clearSlideshow()
directoryViewModel.clearSlideshow()
navController.navigate(Screen.SLIDESHOW.name)
},
onShowPlaylists = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.kevinschildhorn.fotopresenter

import co.touchlab.kermit.Logger
import co.touchlab.kermit.LoggerConfig
import com.kevinschildhorn.fotopresenter.data.DirectoryEtc
import com.kevinschildhorn.fotopresenter.data.datasources.CredentialsDataSource
import com.kevinschildhorn.fotopresenter.data.datasources.DirectoryDataSource
import com.kevinschildhorn.fotopresenter.data.datasources.ImageCacheDataSource
Expand All @@ -25,7 +24,6 @@ import com.kevinschildhorn.fotopresenter.domain.image.RetrieveImageUseCase
import com.kevinschildhorn.fotopresenter.domain.image.RetrieveSlideshowFromPlaylistUseCase
import com.kevinschildhorn.fotopresenter.domain.image.SaveMetadataForPathUseCase
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.directory.DirectoryViewModelTwo
import com.kevinschildhorn.fotopresenter.ui.screens.login.LoginViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.playlist.PlaylistViewModel
import com.kevinschildhorn.fotopresenter.ui.screens.slideshow.SlideshowViewModel
Expand All @@ -47,8 +45,6 @@ val commonModule =
single { CredentialsRepository(get()) }
single { DirectoryDataSource(get(), baseLogger.withTag("DirectoryDataSource")) }
single { DirectoryRepository(get(), get()) }
single { DirectoryEtc(get(), get(), baseLogger.withTag("DirectoryEtc")) }

single { ImageRemoteDataSource(get()) }
single { ImageRepository(get()) }
single { ImageCacheDataSource(get(), get(), baseLogger.withTag("ImageCacheDataSource")) }
Expand Down Expand Up @@ -87,8 +83,7 @@ val commonModule =
factory { SaveMetadataForPathUseCase(get()) }
// UI
single { LoginViewModel(baseLogger.withTag("LoginViewModel"), get()) }
single { DirectoryViewModel(get(), baseLogger.withTag("DirectoryViewModel"), get(), get()) }
single { DirectoryViewModelTwo(get(), baseLogger.withTag("DirectoryViewModel"), get(), get())}
single { DirectoryViewModel(get(), baseLogger.withTag("DirectoryViewModel")) }
single { SlideshowViewModel(baseLogger.withTag("SlideshowViewModel")) }
single { PlaylistViewModel(get(), baseLogger.withTag("PlaylistViewModel")) }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.kevinschildhorn.fotopresenter.data

import androidx.compose.ui.graphics.ImageBitmap
import com.kevinschildhorn.fotopresenter.data.network.NetworkDirectoryDetails
import com.kevinschildhorn.fotopresenter.ui.SortingType
import com.kevinschildhorn.fotopresenter.ui.shared.SharedImage
Expand Down Expand Up @@ -30,7 +29,6 @@ data class ImageDirectory(
override val details: NetworkDirectoryDetails,
val metaData: MetadataFileDetails?,
val image: SharedImage? = null,
val imageBitmap: ImageBitmap? = null,
) : Directory {
override fun toString(): String = "(I:${details.fullPath}:${details.id})"
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ class DirectoryRepository(
private val directoryDataSource: DirectoryDataSource,
private val metadataDataSource: ImageMetadataDataSource,
) {
// Retrieves [NetworkDirectoryDetails] for folders and directories. Contains no bitmap data
suspend fun getDirectoryContents(path: String): DirectoryContents {
val folderDirectories: List<NetworkDirectoryDetails> =
directoryDataSource.getFolderDirectories(path)
val imageDirectories: List<NetworkDirectoryDetails> =
directoryDataSource.getImageDirectories(path)

//val metaData = metadataDataSource.importMetaData()
val metaData = metadataDataSource.importMetaData()


return DirectoryContents(
folders = folderDirectories.map { FolderDirectory(it) },
images = imageDirectories.map { networkDetails ->
ImageDirectory(
networkDetails,
metaData = null, //metaData.files.find { networkDetails.fullPath == it.filePath }
image = null,
metaData = metaData.files.find { networkDetails.fullPath == it.filePath }
)
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ import com.kevinschildhorn.fotopresenter.ui.shared.SharedImage
class ImageRepository(
private val remoteDataSource: ImageRemoteDataSource,
) {
// Gets Image ByteArray from a Remote Data Source
suspend fun getImage(directory: NetworkDirectoryDetails): SharedImage? = remoteDataSource.getImage(directory)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class RetrieveImageUseCase(
private val logger: Logger,
) {

operator fun invoke(
suspend operator fun invoke(
directory: ImageDirectory,
imageSize: Int,
): ImageBitmap? {
Expand Down
Loading

0 comments on commit b8e51af

Please sign in to comment.