Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] use DevicesPreviews #123

Open
Kaaveh opened this issue Oct 5, 2023 · 2 comments
Open

[refactor] use DevicesPreviews #123

Kaaveh opened this issue Oct 5, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@Kaaveh
Copy link
Owner

Kaaveh commented Oct 5, 2023

In the MainActivity there is code:

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@Preview(showBackground = true, widthDp = 700, heightDp = 500)
@Composable
fun ComposeNewsAppPreviewTablet() {
    ComposeNewsTheme {
        ComposeNewsApp(
            windowSize = WindowSizeClass.calculateFromSize(DpSize(700.dp, 500.dp)),
            displayFeatures = emptyList(),
            uiState = MainContract.State(),
            closeDetailScreen = {},
        )
    }
}

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@Preview(showBackground = true, widthDp = 500, heightDp = 700)
@Composable
fun ComposeNewsAppPreviewTabletPortrait() {
    ComposeNewsTheme {
        ComposeNewsApp(
            windowSize = WindowSizeClass.calculateFromSize(DpSize(500.dp, 700.dp)),
            displayFeatures = emptyList(),
            uiState = MainContract.State(),
            closeDetailScreen = {},
        )
    }
}

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@Preview(showBackground = true, widthDp = 1100, heightDp = 600)
@Composable
fun ComposeNewsAppPreviewDesktop() {
    ComposeNewsTheme {
        ComposeNewsApp(
            windowSize = WindowSizeClass.calculateFromSize(DpSize(1100.dp, 600.dp)),
            displayFeatures = emptyList(),
            uiState = MainContract.State(),
            closeDetailScreen = {},
        )
    }
}

@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
@Preview(showBackground = true, widthDp = 600, heightDp = 1100)
@Composable
fun ComposeNewsAppPreviewDesktopPortrait() {
    ComposeNewsTheme {
        ComposeNewsApp(
            windowSize = WindowSizeClass.calculateFromSize(DpSize(600.dp, 1100.dp)),
            displayFeatures = emptyList(),
            uiState = MainContract.State(),
            closeDetailScreen = {},
        )
    }
}

Replace it with DevicesPreviews defined in designsystem module

@Kaaveh Kaaveh converted this from a draft issue Oct 5, 2023
@Kaaveh Kaaveh added enhancement New feature or request hacktoberfest labels Oct 5, 2023
@mhmd-android
Copy link
Contributor

Hi dear Kaaveh, can I do this task?

@Kaaveh
Copy link
Owner Author

Kaaveh commented Oct 29, 2023

@mhmd-android Sure! I'll assign it to you! 🙌🏻

VahidGarousi added a commit to VahidGarousi/ComposeNews that referenced this issue Dec 2, 2024
- Moved SQLDelight `.sq` file to a separate `ComposeNews.data.sqldelight` module.
- Updated dependencies in `build.gradle.kts` and `settings.gradle.kts`.
- Refactored database access logic to ensure modularity and isolation of SQLDelight API.
- Adjusted `MarketDaoImpl.kt` to align with the new structure.
VahidGarousi added a commit to VahidGarousi/ComposeNews that referenced this issue Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants