diff --git a/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreen.kt b/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreen.kt index 243e31578..3c0ffb67b 100644 --- a/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreen.kt +++ b/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreen.kt @@ -1,18 +1,23 @@ package com.flixclusive.feature.mobile.provider.settings +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable +import androidx.compose.runtime.currentComposer import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.flixclusive.core.ui.common.navigation.GoBackAction import com.flixclusive.core.ui.mobile.util.isScrollingUp +import com.flixclusive.feature.mobile.provider.settings.component.ProviderSettingsHeader import com.flixclusive.feature.mobile.provider.settings.component.ProviderSettingsTopBar import com.flixclusive.gradle.entities.ProviderData import com.ramcosta.composedestinations.annotation.Destination @@ -43,13 +48,41 @@ fun ProviderSettingsScreen( onNavigationIconClick = navigator::goBack ) } - ) { + ) { innerPadding -> Box( modifier = Modifier - .padding(it) + .padding(innerPadding) .fillMaxSize() ) { - viewModel.providerInstance?.SettingsScreen() + LazyColumn( + state = listState, + verticalArrangement = Arrangement.spacedBy(8.dp), + modifier = Modifier + .padding(horizontal = 10.dp) + ) { + item { + ProviderSettingsHeader(providerData = args.providerData) + } + + // This is where the SettingsScreen should go inside the ProviderManifest + item { + if (viewModel.providerInstance != null) { + // Need to call the composable with the reflection way bc + // Compose won't let us call it the normal way. + val method = remember { + viewModel.providerInstance::class.java + .declaredMethods + .find { + it.name.equals("SettingsScreen") + }?.also { + it.isAccessible = true + } + } + + method?.invoke(viewModel.providerInstance, currentComposer, 0, 0) + } + } + } } } } diff --git a/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreenViewModel.kt b/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreenViewModel.kt index 7e3492c5d..6f7edbf13 100644 --- a/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreenViewModel.kt +++ b/feature/mobile/provider-settings/src/main/kotlin/com/flixclusive/feature/mobile/provider/settings/ProviderSettingsScreenViewModel.kt @@ -2,7 +2,6 @@ package com.flixclusive.feature.mobile.provider.settings import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel -import com.flixclusive.core.util.log.debugLog import com.flixclusive.data.provider.ProviderManager import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @@ -14,8 +13,4 @@ class ProviderSettingsScreenViewModel @Inject constructor( ) : ViewModel() { val providerData = savedStateHandle.navArgs().providerData val providerInstance = providerManager.providers[providerData.name] - - init { - debugLog("Provider => $providerInstance") - } } diff --git a/provider/build.gradle.kts b/provider/build.gradle.kts index d2c4cc16a..9798a5d44 100644 --- a/provider/build.gradle.kts +++ b/provider/build.gradle.kts @@ -14,7 +14,16 @@ dependencies { api(projects.core.util) api(projects.model.provider) + implementation(libs.coil.compose) + implementation(libs.compose.foundation) + implementation(libs.compose.material3) + implementation(libs.compose.runtime) + implementation(libs.compose.tv.material) + implementation(libs.compose.ui) + implementation(libs.compose.ui.tooling.preview) + implementation(libs.constraintlayout.compose) implementation(libs.coroutines.test) implementation(libs.junit) + implementation(libs.lifecycle.runtimeCompose) implementation(libs.mockk) } \ No newline at end of file diff --git a/provider/src/main/kotlin/com/flixclusive/provider/Provider.kt b/provider/src/main/kotlin/com/flixclusive/provider/Provider.kt index 7db044aa4..c0c5ea6a6 100644 --- a/provider/src/main/kotlin/com/flixclusive/provider/Provider.kt +++ b/provider/src/main/kotlin/com/flixclusive/provider/Provider.kt @@ -76,7 +76,5 @@ abstract class Provider() { * ``` * */ @Composable - open fun SettingsScreen( - resources: Resources? = this.resources, - ) = Unit + open fun SettingsScreen() = Unit } \ No newline at end of file