Repository navigation
iOS: rename and pin workspaces from the phone #5512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
61af99a
iOS: rename and pin workspaces from the phone
lawrencecchen d524935
Fix PR2 mobile gate: route workspace.action through the real mobile d…
lawrencecchen 7ab6b17
PR2 review: roll back only the targeted workspace field, match-guarded
lawrencecchen 284a6e0
PR2 review: drop optimistic rename/pin, rely on authoritative push
lawrencecchen 90d1a8f
PR2 review: gate rename/pin UI on a host capability
lawrencecchen 88a39cc
PR2: build the capability-gated closures as literals
lawrencecchen 00faf13
PR2 review: advertise workspace.actions.v1 on the live status paths
lawrencecchen 6bc3e28
PR2 review: require an explicit valid workspace_id for mobile actions
lawrencecchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
63 changes: 63 additions & 0 deletions
63
Packages/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceRenameSheet.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #if os(iOS) | ||
| import CmuxMobileSupport | ||
| import SwiftUI | ||
|
|
||
| /// A small sheet that renames a workspace from the mobile workspace list. | ||
| /// | ||
| /// Seeds its text field with the current name and hands the trimmed result back | ||
| /// through `onSave`; the caller forwards it to the Mac. Whitespace-only names are | ||
| /// rejected (Save is disabled). | ||
| struct WorkspaceRenameSheet: View { | ||
| @Environment(\.dismiss) private var dismiss | ||
| private let onSave: (String) -> Void | ||
| @State private var name: String | ||
|
|
||
| /// Creates the rename sheet. | ||
| /// - Parameters: | ||
| /// - currentName: The workspace's current name, used to seed the field. | ||
| /// - onSave: Called with the new trimmed name when the user taps Save. | ||
| init(currentName: String, onSave: @escaping (String) -> Void) { | ||
| self.onSave = onSave | ||
| _name = State(initialValue: currentName) | ||
| } | ||
|
|
||
| var body: some View { | ||
| NavigationStack { | ||
| Form { | ||
| TextField( | ||
| L10n.string("mobile.workspace.rename.placeholder", defaultValue: "Workspace name"), | ||
| text: $name | ||
| ) | ||
| .autocorrectionDisabled() | ||
| .submitLabel(.done) | ||
| .onSubmit(save) | ||
| .accessibilityIdentifier("WorkspaceRenameField") | ||
| } | ||
| .navigationTitle(L10n.string("mobile.workspace.rename.title", defaultValue: "Rename Workspace")) | ||
| .mobileInlineNavigationTitle() | ||
| .toolbar { | ||
| ToolbarItem(placement: .cancellationAction) { | ||
| Button(L10n.string("mobile.common.cancel", defaultValue: "Cancel")) { | ||
| dismiss() | ||
| } | ||
| .accessibilityIdentifier("WorkspaceRenameCancelButton") | ||
| } | ||
| ToolbarItem(placement: .confirmationAction) { | ||
| Button(L10n.string("mobile.common.save", defaultValue: "Save")) { | ||
| save() | ||
| } | ||
| .disabled(name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty) | ||
| .accessibilityIdentifier("WorkspaceRenameSaveButton") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private func save() { | ||
| let trimmed = name.trimmingCharacters(in: .whitespacesAndNewlines) | ||
| guard !trimmed.isEmpty else { return } | ||
| onSave(trimmed) | ||
| dismiss() | ||
| } | ||
| } | ||
| #endif |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.