Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite1000fe

Browse files
committed
review
1 parente425548 commite1000fe

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

‎Coder-Desktop/Coder-Desktop/Views/FileSync/FilePicker.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ class FilePickerModel: ObservableObject {
7878
@PublishedvarisLoading:Bool=false
7979
@Publishedvarerror:ClientError?
8080

81-
letclient:Client
81+
letclient:AgentClient
8282

8383
init(host:String){
84-
client=Client(url:URL(string:"http://\(host):4")!)
84+
client=AgentClient(agentHost:host)
8585
}
8686

8787
func loadRoot(){
@@ -176,7 +176,7 @@ class FilePickerItemModel: Identifiable, ObservableObject {
176176
// This being a binding is pretty important performance-wise, as it's a struct
177177
// that would otherwise be recreated every time the the item row is rendered.
178178
// Removing the binding results in very noticeable lag when scrolling a file tree.
179-
@Bindingvarclient:Client
179+
@Bindingvarclient:AgentClient
180180

181181
@Publishedvarcontents:[FilePickerItemModel]?
182182
@PublishedvarisLoading=false
@@ -197,7 +197,7 @@ class FilePickerItemModel: Identifiable, ObservableObject {
197197

198198
init(
199199
name:String,
200-
client:Binding<Client>,
200+
client:Binding<AgentClient>,
201201
absolute_path:String,
202202
path:[String],
203203
dir:Bool=false,
@@ -237,7 +237,7 @@ class FilePickerItemModel: Identifiable, ObservableObject {
237237

238238
extensionLSResponse{
239239
@MainActor
240-
func toModels(client:Binding<Client>, path:[String])->[FilePickerItemModel]{
240+
func toModels(client:Binding<AgentClient>, path:[String])->[FilePickerItemModel]{
241241
contents.compactMap{ filein
242242
// Filter dotfiles from the picker
243243
guard !file.name.hasPrefix(".")else{returnnil}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
publicstructAgentClient:Sendable{
2+
letclient:Client
3+
4+
publicinit(agentHost:String){
5+
client=Client(url:URL(string:"http://\(agentHost):4")!)
6+
}
7+
}

‎Coder-Desktop/CoderSDK/AgentLS.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
publicextensionClient{
2-
// The Client's URL MUST be set to that of an accessible agent
1+
publicextensionAgentClient{
32
func listAgentDirectory(_ req:LSRequest)asyncthrows(ClientError)->LSResponse{
4-
letres=tryawaitrequest("/api/v0/list-directory", method:.post, body: req)
3+
letres=tryawaitclient.request("/api/v0/list-directory", method:.post, body: req)
54
guard res.resp.statusCode==200else{
6-
throwresponseAsError(res)
5+
throwclient.responseAsError(res)
76
}
8-
returntrydecode(LSResponse.self, from: res.data)
7+
returntryclient.decode(LSResponse.self, from: res.data)
98
}
109
}
1110

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp