feat: Update Gradle wrapper to version 8.13
feat: Add JitPack repository to dependency resolution management feat: Create ViewStyle enum for bookmark display styles feat: Implement EditLinkScreen with ViewModel for editing links feat: Add EditLinkViewModel to manage link editing state and logic feat: Create LinkItemViews for displaying links in various formats chore: Add build output and compile output logs
This commit is contained in:
@@ -18,100 +18,115 @@ sealed class Screen(val route: String) {
|
||||
}
|
||||
}
|
||||
object Add : Screen("add?url={url}&title={title}&isShare={isShare}")
|
||||
object Edit : Screen("edit/{linkId}") {
|
||||
fun createRoute(linkId: Int): String = "edit/$linkId"
|
||||
}
|
||||
object Tags : Screen("tags")
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AppNavGraph(
|
||||
startDestination: String = Screen.Login.route,
|
||||
shareUrl: String? = null,
|
||||
shareTitle: String? = null
|
||||
startDestination: String = Screen.Login.route,
|
||||
shareUrl: String? = null,
|
||||
shareTitle: String? = null
|
||||
) {
|
||||
val navController = rememberNavController()
|
||||
val context = LocalContext.current
|
||||
val isShareIntent = shareUrl != null
|
||||
|
||||
NavHost(navController = navController, startDestination = startDestination) {
|
||||
composable(Screen.Login.route) {
|
||||
com.shaarit.presentation.auth.LoginScreen(
|
||||
onLoginSuccess = {
|
||||
if (shareUrl != null) {
|
||||
// Use proper URL encoding that handles spaces correctly
|
||||
val encodedUrl = URLEncoder.encode(shareUrl, "UTF-8")
|
||||
val encodedTitle =
|
||||
if (shareTitle != null) {
|
||||
URLEncoder.encode(shareTitle, "UTF-8")
|
||||
} else ""
|
||||
navController.navigate("add?url=$encodedUrl&title=$encodedTitle&isShare=true") {
|
||||
popUpTo(Screen.Login.route) { inclusive = true }
|
||||
}
|
||||
} else {
|
||||
navController.navigate(Screen.Feed.createRoute()) {
|
||||
popUpTo(Screen.Login.route) { inclusive = true }
|
||||
}
|
||||
onLoginSuccess = {
|
||||
if (shareUrl != null) {
|
||||
// Use proper URL encoding that handles spaces correctly
|
||||
val encodedUrl = URLEncoder.encode(shareUrl, "UTF-8")
|
||||
val encodedTitle =
|
||||
if (shareTitle != null) {
|
||||
URLEncoder.encode(shareTitle, "UTF-8")
|
||||
} else ""
|
||||
navController.navigate("add?url=$encodedUrl&title=$encodedTitle&isShare=true") {
|
||||
popUpTo(Screen.Login.route) { inclusive = true }
|
||||
}
|
||||
} else {
|
||||
navController.navigate(Screen.Feed.createRoute()) {
|
||||
popUpTo(Screen.Login.route) { inclusive = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
composable(
|
||||
route = "feed?tag={tag}",
|
||||
arguments =
|
||||
listOf(
|
||||
navArgument("tag") {
|
||||
type = NavType.StringType
|
||||
nullable = true
|
||||
defaultValue = null
|
||||
}
|
||||
)
|
||||
route = "feed?tag={tag}",
|
||||
arguments = listOf(
|
||||
navArgument("tag") {
|
||||
type = NavType.StringType
|
||||
nullable = true
|
||||
defaultValue = null
|
||||
}
|
||||
)
|
||||
) { backStackEntry ->
|
||||
val tag = backStackEntry.arguments?.getString("tag")
|
||||
com.shaarit.presentation.feed.FeedScreen(
|
||||
onNavigateToAdd = { navController.navigate("add?url=&title=&isShare=false") },
|
||||
onNavigateToTags = { navController.navigate(Screen.Tags.route) },
|
||||
initialTagFilter = tag
|
||||
onNavigateToAdd = { navController.navigate("add?url=&title=&isShare=false") },
|
||||
onNavigateToEdit = { linkId ->
|
||||
navController.navigate(Screen.Edit.createRoute(linkId))
|
||||
},
|
||||
onNavigateToTags = { navController.navigate(Screen.Tags.route) },
|
||||
initialTagFilter = tag
|
||||
)
|
||||
}
|
||||
|
||||
composable(
|
||||
route = "add?url={url}&title={title}&isShare={isShare}",
|
||||
arguments =
|
||||
listOf(
|
||||
navArgument("url") {
|
||||
type = NavType.StringType
|
||||
defaultValue = ""
|
||||
nullable = true
|
||||
},
|
||||
navArgument("title") {
|
||||
type = NavType.StringType
|
||||
defaultValue = ""
|
||||
nullable = true
|
||||
},
|
||||
navArgument("isShare") {
|
||||
type = NavType.BoolType
|
||||
defaultValue = false
|
||||
}
|
||||
)
|
||||
route = "add?url={url}&title={title}&isShare={isShare}",
|
||||
arguments = listOf(
|
||||
navArgument("url") {
|
||||
type = NavType.StringType
|
||||
defaultValue = ""
|
||||
nullable = true
|
||||
},
|
||||
navArgument("title") {
|
||||
type = NavType.StringType
|
||||
defaultValue = ""
|
||||
nullable = true
|
||||
},
|
||||
navArgument("isShare") {
|
||||
type = NavType.BoolType
|
||||
defaultValue = false
|
||||
}
|
||||
)
|
||||
) { backStackEntry ->
|
||||
val isShare = backStackEntry.arguments?.getBoolean("isShare") ?: false
|
||||
com.shaarit.presentation.add.AddLinkScreen(
|
||||
onNavigateBack = { navController.popBackStack() },
|
||||
onShareSuccess = if (isShare) {
|
||||
{ (context as? Activity)?.finish() }
|
||||
} else null
|
||||
onNavigateBack = { navController.popBackStack() },
|
||||
onShareSuccess = if (isShare) {
|
||||
{ (context as? Activity)?.finish() }
|
||||
} else null
|
||||
)
|
||||
}
|
||||
|
||||
composable(
|
||||
route = "edit/{linkId}",
|
||||
arguments = listOf(
|
||||
navArgument("linkId") {
|
||||
type = NavType.IntType
|
||||
}
|
||||
)
|
||||
) {
|
||||
com.shaarit.presentation.edit.EditLinkScreen(
|
||||
onNavigateBack = { navController.popBackStack() }
|
||||
)
|
||||
}
|
||||
|
||||
composable(Screen.Tags.route) {
|
||||
com.shaarit.presentation.tags.TagsScreen(
|
||||
onNavigateBack = { navController.popBackStack() },
|
||||
onNavigateToFeedWithTag = { tag ->
|
||||
navController.navigate(Screen.Feed.createRoute(tag)) {
|
||||
popUpTo(Screen.Tags.route) { inclusive = true }
|
||||
}
|
||||
onNavigateBack = { navController.popBackStack() },
|
||||
onNavigateToFeedWithTag = { tag ->
|
||||
navController.navigate(Screen.Feed.createRoute(tag)) {
|
||||
popUpTo(Screen.Tags.route) { inclusive = true }
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user