GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — OPE-63 Fix add-project listing, persistence, and iOS sheet presentation. · opencode-mobile/opencode-mobile@2fdb1fb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • android/app/src
    • main/java/dev/opencode/mobile
      • data/remote
        • FilesystemApi.kt
      • domain/filesystem
        • DefaultFilesystemRepository.kt
      • ui
        • componentgallery/components
          • BottomSheetGalleryScreen.kt
          • IconsGalleryScreen.kt
        • icons
          • OpenCodeIcons.kt
        • main
          • MainScreen.kt
          • MainScreenViewModel.kt
    • test/java/dev/opencode/mobile/ui/main
      • MainScreenViewModelTest.kt
  • api
    • opencode-projects.openapi.yaml
  • docs
    • design-system
      • icons.md
    • features/add-project
      • decisions.md
      • plan.md
      • progress.md
  • icons
    • .manifest-hash
    • manifest.yaml
  • ios/OpenCode Mobile
    • OpenCode MobileTests
      • ProjectListHomeViewModelTests.swift
    • OpenCode Mobile
      • ComponentGallery/Components
        • BottomSheetGalleryView.swift
      • Data/Remote
        • FilesystemAPIClient.swift
      • Domain/Filesystem
        • FilesystemRepository.swift
      • Icons
        • OpenCodeIcon.swift
      • MaterialIcons.xcassets
        • md_arrow_downward.imageset
          • icon.svg
        • md_folder_check.imageset
          • Contents.json
          • icon.svg
        • md_subdirectory_arrow_right.imageset
          • Contents.json
          • icon.svg
      • UI/Main
        • ProjectListHomeView.swift
        • ProjectListHomeViewModel.swift
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎android/app/src/main/java/dev/opencode/mobile/data/remote/FilesystemApi.kt‎

Copy file name to clipboardExpand all lines: android/app/src/main/java/dev/opencode/mobile/data/remote/FilesystemApi.kt
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package dev.opencode.mobile.data.remote
33
import dev.opencode.mobile.data.remote.dto.FileNodeDto
44
import dev.opencode.mobile.data.remote.dto.PathDto
55
import dev.opencode.mobile.network.OpencodeHttpClient
6+
import dev.opencode.mobile.network.applyDirectory
67
import io.ktor.client.call.body
78
import io.ktor.client.request.get
89
import io.ktor.client.request.parameter
@@ -12,10 +13,12 @@ class FilesystemApi(
1213
) {
1314
suspend fun getPaths(): PathDto = httpClient.get().get("path").body()
1415

15-
suspend fun listFiles(path: String): List<FileNodeDto> =
16+
// Lists absoluteDirectory via path=. + directory= so paths outside the boot worktree work.
17+
suspend fun listFiles(absoluteDirectory: String): List<FileNodeDto> =
1618
httpClient
1719
.get()
1820
.get("file") {
19-
parameter("path", path)
21+
parameter("path", ".")
22+
applyDirectory(absoluteDirectory)
2023
}.body()
2124
}
Collapse file

‎android/app/src/main/java/dev/opencode/mobile/domain/filesystem/DefaultFilesystemRepository.kt‎

Copy file name to clipboardExpand all lines: android/app/src/main/java/dev/opencode/mobile/domain/filesystem/DefaultFilesystemRepository.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ class DefaultFilesystemRepository
1212
override suspend fun getPaths(): ServerPaths = adapter.toServerPaths(api.getPaths())
1313

1414
override suspend fun listDirectory(path: String): List<DirectoryNode> =
15-
DirectoryListingPolicy.prepare(api.listFiles(path).map(adapter::toDirectoryNode))
15+
DirectoryListingPolicy.prepare(api.listFiles(absoluteDirectory = path).map(adapter::toDirectoryNode))
1616
}
Collapse file

‎android/app/src/main/java/dev/opencode/mobile/ui/componentgallery/components/BottomSheetGalleryScreen.kt‎

Copy file name to clipboardExpand all lines: android/app/src/main/java/dev/opencode/mobile/ui/componentgallery/components/BottomSheetGalleryScreen.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fun BottomSheetGalleryScreen(modifier: Modifier = Modifier) {
114114
)
115115
OpenCodeBottomSheetEntry(
116116
title = "/Users/demo/Projects",
117-
startDecorator = BottomSheetEntryDecorator.Icon(OpenCodeIcons.Folder, null),
117+
startDecorator = BottomSheetEntryDecorator.Icon(OpenCodeIcons.FolderCheck, null),
118118
onClick = {},
119119
)
120120
}
Collapse file

‎android/app/src/main/java/dev/opencode/mobile/ui/componentgallery/components/IconsGalleryScreen.kt‎

Copy file name to clipboardExpand all lines: android/app/src/main/java/dev/opencode/mobile/ui/componentgallery/components/IconsGalleryScreen.kt
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ fun IconsGalleryScreen(modifier: Modifier = Modifier) {
3939
"edit" to OpenCodeIcons.Edit,
4040
"expand_content" to OpenCodeIcons.ExpandContent,
4141
"folder" to OpenCodeIcons.Folder,
42+
"folder_check" to OpenCodeIcons.FolderCheck,
4243
"more_vert" to OpenCodeIcons.MoreVert,
4344
"search" to OpenCodeIcons.Search,
4445
"architecture" to OpenCodeIcons.Architecture,
4546
"archive" to OpenCodeIcons.Archive,
4647
"cloud" to OpenCodeIcons.Cloud,
4748
"stop" to OpenCodeIcons.Stop,
4849
"stop_circle" to OpenCodeIcons.StopCircle,
50+
"subdirectory_arrow_right" to OpenCodeIcons.SubdirectoryArrowRight,
4951
"undo" to OpenCodeIcons.Undo,
5052
"widgets" to OpenCodeIcons.Widgets,
5153
)
Collapse file

‎android/app/src/main/java/dev/opencode/mobile/ui/icons/OpenCodeIcons.kt‎

Copy file name to clipboardExpand all lines: android/app/src/main/java/dev/opencode/mobile/ui/icons/OpenCodeIcons.kt
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ private var _description: ImageVector? = null
2323
private var _edit: ImageVector? = null
2424
private var _expand_content: ImageVector? = null
2525
private var _folder: ImageVector? = null
26+
private var _folder_check: ImageVector? = null
2627
private var _list: ImageVector? = null
2728
private var _more_vert: ImageVector? = null
2829
private var _search: ImageVector? = null
@@ -32,6 +33,7 @@ private var _archive: ImageVector? = null
3233
private var _cloud: ImageVector? = null
3334
private var _stop: ImageVector? = null
3435
private var _stop_circle: ImageVector? = null
36+
private var _subdirectory_arrow_right: ImageVector? = null
3537
private var _undo: ImageVector? = null
3638
private var _widgets: ImageVector? = null
3739

@@ -292,6 +294,30 @@ private var _widgets: ImageVector? = null
292294
return _folder!!
293295
}
294296

297+
val FolderCheck: ImageVector
298+
get() {
299+
if (_folder_check != null) return _folder_check!!
300+
_folder_check = ImageVector.Builder(
301+
name = "FolderCheck",
302+
defaultWidth = 24.dp,
303+
defaultHeight = 24.dp,
304+
viewportWidth = 960f,
305+
viewportHeight = 960f,
306+
).apply {
307+
group(
308+
translationX = 0f,
309+
translationY = 960f,
310+
) {
311+
addPath(
312+
pathData = PathParser().parsePathString("m434-297 226-227-56-56-170 170-85-85-57 57 142 141ZM160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640v400q0 33-23.5 56.5T800-160H160Zm0-80h640v-400H447l-80-80H160v480Zm0 0v-480 480Z").toNodes(),
313+
fill = SolidColor(Color.Black),
314+
pathFillType = PathFillType.NonZero,
315+
)
316+
}
317+
}.build()
318+
return _folder_check!!
319+
}
320+
295321
val List: ImageVector
296322
get() {
297323
if (_list != null) return _list!!
@@ -463,6 +489,25 @@ private var _widgets: ImageVector? = null
463489
return _stop_circle!!
464490
}
465491

492+
val SubdirectoryArrowRight: ImageVector
493+
get() {
494+
if (_subdirectory_arrow_right != null) return _subdirectory_arrow_right!!
495+
_subdirectory_arrow_right = ImageVector.Builder(
496+
name = "SubdirectoryArrowRight",
497+
defaultWidth = 24.dp,
498+
defaultHeight = 24.dp,
499+
viewportWidth = 24f,
500+
viewportHeight = 24f,
501+
).apply {
502+
addPath(
503+
pathData = PathParser().parsePathString("m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z").toNodes(),
504+
fill = SolidColor(Color.Black),
505+
pathFillType = PathFillType.NonZero,
506+
)
507+
}.build()
508+
return _subdirectory_arrow_right!!
509+
}
510+
466511
val Undo: ImageVector
467512
get() {
468513
if (_undo != null) return _undo!!
Collapse file

‎android/app/src/main/java/dev/opencode/mobile/ui/main/MainScreen.kt‎

Copy file name to clipboardExpand all lines: android/app/src/main/java/dev/opencode/mobile/ui/main/MainScreen.kt
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ internal fun MainScreen(
218218
enabled = navigator.currentPath.isNotBlank() && !navigator.isLoading && !navigator.isValidating,
219219
startDecorator =
220220
BottomSheetEntryDecorator.Icon(
221-
imageVector = OpenCodeIcons.Folder,
221+
imageVector = OpenCodeIcons.FolderCheck,
222222
contentDescription = null,
223223
),
224224
onClick = onSelectCurrentDirectory,
@@ -263,7 +263,7 @@ internal fun MainScreen(
263263
title = entry.name,
264264
startDecorator =
265265
BottomSheetEntryDecorator.Icon(
266-
imageVector = OpenCodeIcons.Folder,
266+
imageVector = OpenCodeIcons.SubdirectoryArrowRight,
267267
contentDescription = null,
268268
),
269269
onClick = { onNavigateAddProjectInto(entry.absolutePath) },
Collapse file

‎android/app/src/main/java/dev/opencode/mobile/ui/main/MainScreenViewModel.kt‎

Copy file name to clipboardExpand all lines: android/app/src/main/java/dev/opencode/mobile/ui/main/MainScreenViewModel.kt
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ class MainScreenViewModel
156156
updateAddProjectNavigator { it.copy(isValidating = true, errorMessage = null) }
157157
val result = runCatching { projectRepository.getCurrentProject(directory = worktree) }
158158
result
159-
.onSuccess { project ->
160-
connectionProfileStore.addWorktree(serverBaseUrl, project.worktree)
161-
requestedFocusWorktree = project.worktree
159+
.onSuccess {
160+
// Persist the selected directory (web open-project behavior), not the
161+
// /project/current worktree — non-git dirs resolve to global "/".
162+
connectionProfileStore.addWorktree(serverBaseUrl, worktree)
163+
requestedFocusWorktree = worktree
162164
dismissAddProjectSheet()
163165
runHomeLoad(skipProbe = true)
164166
}.onFailure { error ->
@@ -321,7 +323,7 @@ class MainScreenViewModel
321323
}
322324

323325
private suspend fun loadSection(worktree: String): ProjectSectionUi {
324-
val project = projectRepository.getCurrentProject(directory = worktree)
326+
projectRepository.getCurrentProject(directory = worktree)
325327
val sessions =
326328
sessionRepository
327329
.listSessions(directory = worktree)
@@ -340,9 +342,9 @@ class MainScreenViewModel
340342
}
341343
return ProjectSectionUi(
342344
worktree = worktree,
343-
displayName = project.displayName,
344-
pathSubtitle = project.worktree,
345-
letter = letterCharacterForProject(project.displayName),
345+
displayName = ProjectDomainAdapter.displayNameFromWorktree(worktree),
346+
pathSubtitle = worktree,
347+
letter = letterCharacterForProject(ProjectDomainAdapter.displayNameFromWorktree(worktree)),
346348
letterAccent = letterAccentForWorktree(worktree),
347349
previewSessions = summaries.take(PREVIEW_SESSION_LIMIT),
348350
allSessions = summaries,
Collapse file

‎android/app/src/test/java/dev/opencode/mobile/ui/main/MainScreenViewModelTest.kt‎

Copy file name to clipboardExpand all lines: android/app/src/test/java/dev/opencode/mobile/ui/main/MainScreenViewModelTest.kt
+75Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,77 @@ class MainScreenViewModelTest {
288288
assertEquals(setOf("/one", "/two"), projectRepository.validatedDirectories.toSet())
289289
}
290290

291+
@Test
292+
fun selectCurrentDirectory_persistsSelectedPathEvenWhenCurrentResolvesGlobal() =
293+
runTest(testDispatcher) {
294+
val store = FakeConnectionProfileStore(initial = listOf("/one"))
295+
val projectRepository =
296+
FakeProjectRepository(
297+
bootWorktree = "/one",
298+
projectsByDirectory =
299+
mapOf(
300+
"/home" to Project(id = "global", worktree = "/", displayName = "/"),
301+
),
302+
)
303+
val filesystem =
304+
FakeFilesystemRepository(
305+
paths = ServerPaths(home = "/home", directory = "/home", worktree = "/"),
306+
listings = mapOf("/home" to emptyList()),
307+
)
308+
val viewModel =
309+
createViewModel(
310+
connectionProfileStore = store,
311+
projectRepository = projectRepository,
312+
filesystemRepository = filesystem,
313+
sessionsByWorktree = mapOf("/one" to emptyList(), "/home" to emptyList()),
314+
)
315+
advanceUntilIdle()
316+
viewModel.showAddProjectSheet()
317+
advanceUntilIdle()
318+
viewModel.selectCurrentDirectory()
319+
advanceUntilIdle()
320+
val loaded = viewModel.uiState.value as MainScreenUiState.Loaded
321+
assertEquals(listOf("/one", "/home"), store.added(serverUrl))
322+
assertEquals("/home", loaded.focusedWorktree)
323+
assertTrue(!loaded.showAddProjectSheet)
324+
}
325+
326+
@Test
327+
fun selectCurrentDirectory_nestedPathPersistsSelectedDirectory() =
328+
runTest(testDispatcher) {
329+
val store = FakeConnectionProfileStore(initial = listOf("/one"))
330+
val projectRepository =
331+
FakeProjectRepository(
332+
bootWorktree = "/one",
333+
projectsByDirectory =
334+
mapOf(
335+
"/repo/android" to
336+
Project(id = "repo", worktree = "/repo", displayName = "repo"),
337+
),
338+
)
339+
val filesystem =
340+
FakeFilesystemRepository(
341+
paths = ServerPaths(home = "/repo/android", directory = "/repo/android", worktree = "/"),
342+
listings = mapOf("/repo/android" to emptyList()),
343+
)
344+
val viewModel =
345+
createViewModel(
346+
connectionProfileStore = store,
347+
projectRepository = projectRepository,
348+
filesystemRepository = filesystem,
349+
sessionsByWorktree = mapOf("/one" to emptyList(), "/repo/android" to emptyList()),
350+
)
351+
advanceUntilIdle()
352+
viewModel.showAddProjectSheet()
353+
advanceUntilIdle()
354+
viewModel.selectCurrentDirectory()
355+
advanceUntilIdle()
356+
val loaded = viewModel.uiState.value as MainScreenUiState.Loaded
357+
assertEquals(listOf("/one", "/repo/android"), store.added(serverUrl))
358+
assertEquals("/repo/android", loaded.focusedWorktree)
359+
assertTrue(!loaded.showAddProjectSheet)
360+
}
361+
291362
@Test
292363
fun selectCurrentDirectory_validationFailureKeepsSheetOpen() =
293364
runTest(testDispatcher) {
@@ -479,6 +550,7 @@ private class FakeProjectRepository(
479550
private val shouldFailProbe: Boolean = false,
480551
private val bootWorktree: String = "/boot/project",
481552
private val currentProjectError: Throwable? = null,
553+
private val projectsByDirectory: Map<String, Project> = emptyMap(),
482554
) : ProjectRepository {
483555
val validatedDirectories = mutableListOf<String?>()
484556

@@ -491,6 +563,9 @@ private class FakeProjectRepository(
491563
override suspend fun getCurrentProject(directory: String?): Project {
492564
validatedDirectories += directory
493565
currentProjectError?.let { throw it }
566+
if (directory != null) {
567+
projectsByDirectory[directory]?.let { return it }
568+
}
494569
return Project(id = "p1", worktree = directory ?: bootWorktree, displayName = "demo")
495570
}
496571
}
Collapse file

‎api/opencode-projects.openapi.yaml‎

Copy file name to clipboardExpand all lines: api/opencode-projects.openapi.yaml
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ paths:
3333
- name: path
3434
in: query
3535
required: true
36+
description: >
37+
Path relative to the scoped instance directory. Use `.` when
38+
browsing an absolute directory via the `directory` query parameter.
39+
schema:
40+
type: string
41+
- name: directory
42+
in: query
43+
description: >
44+
Absolute directory that becomes the server instance scope for this
45+
request. Required when listing outside the server boot directory
46+
(e.g. browsing home for Add project).
3647
schema:
3748
type: string
3849
responses:
Collapse file

‎docs/design-system/icons.md‎

Copy file name to clipboardExpand all lines: docs/design-system/icons.md
+2-1Lines changed: 2 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Some catalog icons have a stable product meaning beyond gallery samples:
3434
| --- | --- |
3535
| `widgets` | Home top-bar action that opens the developer-only Component Gallery (`accessibilityLabel`: Developer components) |
3636
| `add` | **Add project** tile on home (start decorator) |
37-
| `folder` | Directory rows and current path in Add project sheet |
37+
| `folder_check` | **Current directory** row in Add project sheet |
38+
| `subdirectory_arrow_right` | Subdirectory rows in Add project sheet |
3839
| `arrow_upward` | **Go up** row in Add project sheet |
3940
| `edit` | Edit/rename affordances in gallery and samples; not the gallery entry on home |
4041
| `archive` | Session Chat overflow **Archive** action |

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.