diff --git a/app/src/main/java/au/com/shiftyjelly/pocketcasts/ui/MainActivity.kt b/app/src/main/java/au/com/shiftyjelly/pocketcasts/ui/MainActivity.kt index 4130f8ee20..6d7202a8f7 100644 --- a/app/src/main/java/au/com/shiftyjelly/pocketcasts/ui/MainActivity.kt +++ b/app/src/main/java/au/com/shiftyjelly/pocketcasts/ui/MainActivity.kt @@ -17,11 +17,8 @@ import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.widget.Toolbar -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.platform.ComposeView import androidx.core.content.ContextCompat @@ -147,7 +144,6 @@ import au.com.shiftyjelly.pocketcasts.ui.theme.ThemeColor import au.com.shiftyjelly.pocketcasts.utils.Network import au.com.shiftyjelly.pocketcasts.utils.featureflag.Feature import au.com.shiftyjelly.pocketcasts.utils.featureflag.FeatureFlag -import au.com.shiftyjelly.pocketcasts.utils.isDeviceRunningOnLowStorage import au.com.shiftyjelly.pocketcasts.utils.log.LogBuffer import au.com.shiftyjelly.pocketcasts.utils.observeOnce import au.com.shiftyjelly.pocketcasts.view.BottomNavHideManager @@ -748,14 +744,8 @@ class MainActivity : ComposeView(viewGroup.context).apply { setContent { val downloadedEpisodesState by viewModel.downloadedEpisodeState.collectAsState() - var isLowStorage by remember { mutableStateOf(false) } - - LaunchedEffect(Unit) { - isLowStorage = isDeviceRunningOnLowStorage() - } val shouldShow = downloadedEpisodesState.downloadedEpisodes != 0L && - isLowStorage && FeatureFlag.isEnabled(Feature.MANAGE_DOWNLOADED_EPISODES) AppTheme(theme.activeTheme) { diff --git a/modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/StorageSettingsFragment.kt b/modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/StorageSettingsFragment.kt index eea261869b..498324fd6d 100644 --- a/modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/StorageSettingsFragment.kt +++ b/modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/StorageSettingsFragment.kt @@ -23,6 +23,7 @@ import au.com.shiftyjelly.pocketcasts.repositories.file.StorageOptions import au.com.shiftyjelly.pocketcasts.settings.viewmodel.StorageSettingsViewModel import au.com.shiftyjelly.pocketcasts.ui.helper.FragmentHostListener import au.com.shiftyjelly.pocketcasts.utils.extensions.pxToDp +import au.com.shiftyjelly.pocketcasts.utils.isDeviceRunningOnLowStorage import au.com.shiftyjelly.pocketcasts.views.fragments.BaseFragment import au.com.shiftyjelly.pocketcasts.views.lowstorage.LowStorageBottomSheetListener import dagger.hilt.android.AndroidEntryPoint @@ -77,7 +78,9 @@ class StorageSettingsFragment : BaseFragment() { super.onViewCreated(view, savedInstanceState) viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { - lowStorageListener?.showModal() + if (isDeviceRunningOnLowStorage()) { + lowStorageListener?.showModal() + } viewModel.permissionRequest.collect { permissionRequest -> if (permissionRequest == Manifest.permission.WRITE_EXTERNAL_STORAGE) { requestPermissionLauncher.launch(permissionRequest)