Share demo screen UI#76
Open
jacobras wants to merge 15 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restructures the demo app UI into a shared, multiplatform DemoScreen (list/detail layout) so web/desktop/android can reuse the same Compose UI while keeping platform-specific authentication wiring and secrets handling.
Changes:
- Introduces shared demo UI components (
DemoScreen, list/detail panes, edit dialogs) and new view models to drive them. - Moves client IDs/secrets into generated
BuildConfigfields (fromlocal.properties) for web/desktop/android demos. - Updates build configuration (KMP JVM targets, Android resources enablement) and small model/display tweaks (
CloudItemId.toString()).
Reviewed changes
Copilot reviewed 24 out of 27 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| library/src/commonMain/kotlin/nl/jacobras/cloudbridge/model/CloudItemId.kt | Overrides toString() to print raw ID value. |
| library/build.gradle.kts | Sets desktop JVM target to 17 for the library module. |
| gradle/libs.versions.toml | Adds Compose Material3 adaptive dependency coordinates. |
| demo/web/src/webMain/kotlin/main.kt | Replaces in-file demo UI with shared DemoScreen + platform auth callbacks. |
| demo/web/build.gradle.kts | Adds BuildConfig generation for web client IDs. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/isWeb.kt | Adds expect flag to detect web at runtime. |
| demo/shared/src/webMain/kotlin/nl/jacobras/cloudbridge/demo/isWeb.web.kt | Web actual for isWeb. |
| demo/shared/src/desktopMain/kotlin/nl/jacobras/cloudbridge/demo/isWeb.desktop.kt | Desktop actual for isWeb. |
| demo/shared/src/androidMain/kotlin/nl/jacobras/cloudbridge/demo/isWeb.android.kt | Android actual for isWeb. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/ServiceViewModel.kt | New per-service VM for listing/downloading/creating/updating/deleting items. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/ServicesList.kt | New services list UI (provider rows with logo + email). |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/ServiceExtensions.kt | Adds CloudService.name / CloudService.logo helpers. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/MainViewModel.kt | Removes old monolithic demo VM. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/FilesList.kt | New files list UI wrapper around FileRow. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/EditDialog.kt | Adds shared dialog for create/edit/delete workflows. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/DetailPane.kt | Adds detail pane UI for a selected service, including create/edit flows. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/DemoViewModel.kt | New top-level demo VM for selection, tokens, and user info caching. |
| demo/shared/src/commonMain/kotlin/nl/jacobras/cloudbridge/demo/ui/DemoScreen.kt | Adds shared adaptive list/detail scaffold demo screen. |
| demo/shared/build.gradle.kts | Adds adaptive deps, enables Android resources, sets desktop JVM target, enables explicit backing fields. |
| demo/desktop/src/desktopMain/kotlin/nl/jacobras/cloudbridge/demo/main.kt | Removes old desktop demo entrypoint. |
| demo/desktop/src/desktopMain/kotlin/nl/jacobras/cloudbridge/demo/desktop/main.kt | New desktop entrypoint that hosts shared DemoScreen and handles auth. |
| demo/desktop/build.gradle.kts | Adds BuildConfig generation and sets desktop JVM target to 17; updates main class. |
| demo/android/src/main/kotlin/nl/jacobras/cloudbridge/demo/MainActivity.kt | Switches Android UI to shared DemoScreen and updates auth wiring to use BuildConfig IDs. |
| demo/android/build.gradle.kts | Adds BuildConfig generation for Android client IDs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+46
to
+57
| fun selectItem(item: CloudItem) { | ||
| selectedItem.update { item } | ||
| viewModelScope.launch { | ||
| try { | ||
| val items = service.downloadFile(item.id) | ||
| content.update { items } | ||
| error.update { "" } | ||
| } catch (e: CloudServiceException) { | ||
| error.update { e.toString() } | ||
| } | ||
| } | ||
| } |
Comment on lines
+70
to
+85
| fun deauthenticate(service: CloudService) { | ||
| when (service) { | ||
| is DropboxService -> { | ||
| DemoSettings.dropboxToken = null | ||
| updateTokens() | ||
| } | ||
| is GoogleDriveService -> { | ||
| DemoSettings.googleDriveToken = null | ||
| updateTokens() | ||
| } | ||
| is OneDriveService -> { | ||
| DemoSettings.oneDriveToken = null | ||
| updateTokens() | ||
| } | ||
| } | ||
| } |
Comment on lines
+19
to
+29
| Column(modifier.verticalScroll(rememberScrollState())) { | ||
| for (item in files) { | ||
| FileRow( | ||
| item = item, | ||
| onClick = { onItemClick(item) } | ||
| ) | ||
| if (item != files.last()) { | ||
| HorizontalDivider(Modifier.padding(vertical = 4.dp)) | ||
| } | ||
| } | ||
| } |
Comment on lines
+54
to
+58
| Image( | ||
| modifier = Modifier.size(32.dp), | ||
| painter = painterResource(service.logo), | ||
| contentDescription = null | ||
| ) |
| val selectedService by viewModel.selectedService.collectAsState() | ||
| val scope = rememberCoroutineScope() | ||
|
|
||
| // TODO: create folder + create file + path filter |
Comment on lines
+3
to
+5
| import java.util.Properties | ||
| import kotlin.apply | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.