Skip to content

Implement Compose Navigation Safe Args #31

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

Merged
merged 3 commits into from
May 13, 2025
Merged

Conversation

NiazSagor
Copy link
Collaborator

@NiazSagor NiazSagor commented May 12, 2025

This commit refactors the navigation within the application to use Compose Navigation Safe Args. Key changes include:

  • Defined sealed class objects for navigation destinations (Login, Profile, Goal, etc.) to improve type safety.
  • Updated LeetCodePlusNavGraph to use the new sealed class destinations and the toRoute extension function for argument handling in the WebView screen.
  • Modified LeetCodePlusNavigation to accept and navigate using the sealed class objects.
  • Added the kotlinx.serialization.json dependency and the corresponding Kotlin serialization plugin for handling navigation arguments.
  • Removed the unused caller parameter from the WebViewScreen composable.

Android Doc: https://developer.android.com/guide/navigation/design/type-safety

NiazSagor added 3 commits May 13, 2025 00:06
This commit refactors the navigation within the application to use Compose Navigation Safe Args. Key changes include:

- Defined sealed class objects for navigation destinations (Login, Profile, Goal, etc.) to improve type safety.
- Updated `LeetCodePlusNavGraph` to use the new sealed class destinations and the `toRoute` extension function for argument handling in the WebView screen.
- Modified `LeetCodePlusNavigation` to accept and navigate using the sealed class objects.
- Added the `kotlinx.serialization.json` dependency and the corresponding Kotlin serialization plugin for handling navigation arguments.
- Removed the unused `caller` parameter from the `WebViewScreen` composable.
# Conflicts:
#	app/src/main/kotlin/com/byteutility/dev/leetcode/plus/ui/navigation/LeetCodePlusNavGraph.kt
#	app/src/main/kotlin/com/byteutility/dev/leetcode/plus/ui/navigation/LeetCodePlusNavigation.kt
This commit replaces the String-based navigation routes with Serializable objects for better type safety and clarity in the navigation graph.
@NiazSagor NiazSagor requested a review from nur-shuvo May 12, 2025 18:19
@nur-shuvo
Copy link
Owner

@NiazSagor Thanks for the contribution.

@nur-shuvo nur-shuvo merged commit 10f5696 into master May 13, 2025
@nur-shuvo nur-shuvo deleted the type-safe-navigation branch May 13, 2025 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants