Skip to content

Share demo screen UI#76

Open
jacobras wants to merge 15 commits into
mainfrom
improvement/demo-ui
Open

Share demo screen UI#76
jacobras wants to merge 15 commits into
mainfrom
improvement/demo-ui

Conversation

@jacobras

@jacobras jacobras commented Jul 2, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BuildConfig fields (from local.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 thread demo/shared/build.gradle.kts
Comment thread demo/android/build.gradle.kts
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 thread demo/web/build.gradle.kts
Comment on lines +3 to +5
import java.util.Properties
import kotlin.apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants