feat(bookshelf): add ServerSettingsScreen for bookshelf-api/ABS config
- Create ServerSettingsViewModel (Hilt) backed by SharedPreferences ServerSettings. - Create ServerSettingsScreen Compose UI with URL/token fields and Save button. - Add SERVER_SETTINGS_ROUTE to AppDestinations and wire in AppNavigation. - Add settings icon in BookshelfLibraryScreen top bar to open settings. - ':app:assembleOssDebug' passes.
This commit is contained in:
parent
d999e9df77
commit
1666ae0fe2
4 changed files with 194 additions and 0 deletions
|
|
@ -83,6 +83,7 @@ object AppDestinations {
|
|||
const val AI_SETTINGS_SCREEN_ROUTE = "ai_settings_screen_route"
|
||||
const val SETTINGS_SCREEN_ROUTE = "settings_screen_route"
|
||||
const val BOOKSHELF_LIBRARY_ROUTE = "bookshelf_library"
|
||||
const val SERVER_SETTINGS_ROUTE = "server_settings"
|
||||
}
|
||||
|
||||
fun shouldInterceptAppNavBack(
|
||||
|
|
@ -438,9 +439,20 @@ fun AppNavigation(
|
|||
viewModel = bookshelfViewModel,
|
||||
onItemClick = { item ->
|
||||
Timber.d("Bookshelf item selected: ${item.id}")
|
||||
},
|
||||
onOpenSettings = {
|
||||
navController.navigateIfReady(AppDestinations.SERVER_SETTINGS_ROUTE)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
composable(route = AppDestinations.SERVER_SETTINGS_ROUTE) {
|
||||
val settingsViewModel: org.dueattendant149.bookreader.bookshelf.ServerSettingsViewModel = hiltViewModel()
|
||||
org.dueattendant149.bookreader.bookshelf.ServerSettingsScreen(
|
||||
viewModel = settingsViewModel,
|
||||
onBackClick = { navController.popBackStackIfReady() }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue