Skip to content

Commit e200dd4

Browse files
authored
feat: add remote directory picker to file sync (#73)
Adds a new remote directory picker window used when creating a file sync to select the remote directory. https://github.com/user-attachments/assets/3c661969-4ba8-46b0-8e3c-e97809c2ae1d ## TODOs: - [x] Use a dropdown for picking workspace agent in the file sync UI, currently it's typed out (and will crash if empty lol) - [x] Fix reactivation of the window, try to make it function like any other system dialog window Closes #27
1 parent b803aa1 commit e200dd4

30 files changed

+1078
-193
lines changed

App/App.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656

5757
<ItemGroup>
5858
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
59+
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.2.250402" />
5960
<PackageReference Include="DependencyPropertyGenerator" Version="1.5.0">
6061
<PrivateAssets>all</PrivateAssets>
6162
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

App/App.xaml.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Diagnostics;
34
using System.IO;
45
using System.Threading;
56
using System.Threading.Tasks;
7+
using Windows.ApplicationModel.Activation;
68
using Coder.Desktop.App.Models;
79
using Coder.Desktop.App.Services;
810
using Coder.Desktop.App.ViewModels;
911
using Coder.Desktop.App.Views;
1012
using Coder.Desktop.App.Views.Pages;
13+
using Coder.Desktop.CoderSdk.Agent;
1114
using Coder.Desktop.Vpn;
1215
using Microsoft.Extensions.Configuration;
1316
using Microsoft.Extensions.DependencyInjection;
1417
using Microsoft.Extensions.Hosting;
18+
using Microsoft.Extensions.Logging;
1519
using Microsoft.UI.Xaml;
1620
using Microsoft.Win32;
1721
using Microsoft.Windows.AppLifecycle;
18-
using Windows.ApplicationModel.Activation;
19-
using Microsoft.Extensions.Logging;
2022
using Serilog;
21-
using System.Collections.Generic;
23+
using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs;
2224

2325
namespace Coder.Desktop.App;
2426

@@ -60,6 +62,8 @@ public App()
6062
loggerConfig.ReadFrom.Configuration(builder.Configuration);
6163
});
6264

65+
services.AddSingleton<IAgentApiClientFactory, AgentApiClientFactory>();
66+
6367
services.AddSingleton<ICredentialManager, CredentialManager>();
6468
services.AddSingleton<IRpcController, RpcController>();
6569

@@ -76,6 +80,8 @@ public App()
7680
// FileSyncListMainPage is created by FileSyncListWindow.
7781
services.AddTransient<FileSyncListWindow>();
7882

83+
// DirectoryPickerWindow views and view models are created by FileSyncListViewModel.
84+
7985
// TrayWindow views and view models
8086
services.AddTransient<TrayWindowLoadingPage>();
8187
services.AddTransient<TrayWindowDisconnectedViewModel>();
@@ -89,7 +95,7 @@ public App()
8995
services.AddTransient<TrayWindow>();
9096

9197
_services = services.BuildServiceProvider();
92-
_logger = (ILogger<App>)(_services.GetService(typeof(ILogger<App>))!);
98+
_logger = (ILogger<App>)_services.GetService(typeof(ILogger<App>))!;
9399

94100
InitializeComponent();
95101
}
@@ -107,7 +113,7 @@ public async Task ExitApplication()
107113
Environment.Exit(0);
108114
}
109115

110-
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
116+
protected override void OnLaunched(LaunchActivatedEventArgs args)
111117
{
112118
_logger.LogInformation("new instance launched");
113119
// Start connecting to the manager in the background.

App/Converters/DependencyObjectSelector.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,7 @@ private static void SelectedKeyPropertyChanged(DependencyObject obj, DependencyP
186186
public sealed class StringToBrushSelectorItem : DependencyObjectSelectorItem<string, Brush>;
187187

188188
public sealed class StringToBrushSelector : DependencyObjectSelector<string, Brush>;
189+
190+
public sealed class StringToStringSelectorItem : DependencyObjectSelectorItem<string, string>;
191+
192+
public sealed class StringToStringSelector : DependencyObjectSelector<string, string>;

App/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private static void Main(string[] args)
2727
try
2828
{
2929
ComWrappersSupport.InitializeComWrappers();
30-
AppInstance mainInstance = GetMainInstance();
30+
var mainInstance = GetMainInstance();
3131
if (!mainInstance.IsCurrent)
3232
{
3333
var activationArgs = AppInstance.GetCurrent().GetActivatedEventArgs();

App/Services/CredentialManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Threading.Tasks;
88
using Coder.Desktop.App.Models;
99
using Coder.Desktop.CoderSdk;
10+
using Coder.Desktop.CoderSdk.Coder;
1011
using Coder.Desktop.Vpn.Utilities;
1112

1213
namespace Coder.Desktop.App.Services;

App/Services/MutagenController.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Coder.Desktop.MutagenSdk.Proto.Service.Prompting;
1313
using Coder.Desktop.MutagenSdk.Proto.Service.Synchronization;
1414
using Coder.Desktop.MutagenSdk.Proto.Synchronization;
15+
using Coder.Desktop.MutagenSdk.Proto.Synchronization.Core.Ignore;
1516
using Coder.Desktop.MutagenSdk.Proto.Url;
1617
using Coder.Desktop.Vpn.Utilities;
1718
using Grpc.Core;
@@ -85,7 +86,9 @@ public interface ISyncSessionController : IAsyncDisposable
8586
/// </summary>
8687
Task<SyncSessionControllerStateModel> RefreshState(CancellationToken ct = default);
8788

88-
Task<SyncSessionModel> CreateSyncSession(CreateSyncSessionRequest req, Action<string> progressCallback, CancellationToken ct = default);
89+
Task<SyncSessionModel> CreateSyncSession(CreateSyncSessionRequest req, Action<string> progressCallback,
90+
CancellationToken ct = default);
91+
8992
Task<SyncSessionModel> PauseSyncSession(string identifier, CancellationToken ct = default);
9093
Task<SyncSessionModel> ResumeSyncSession(string identifier, CancellationToken ct = default);
9194
Task TerminateSyncSession(string identifier, CancellationToken ct = default);
@@ -200,7 +203,8 @@ public async Task<SyncSessionControllerStateModel> RefreshState(CancellationToke
200203
return state;
201204
}
202205

203-
public async Task<SyncSessionModel> CreateSyncSession(CreateSyncSessionRequest req, Action<string>? progressCallback = null, CancellationToken ct = default)
206+
public async Task<SyncSessionModel> CreateSyncSession(CreateSyncSessionRequest req,
207+
Action<string>? progressCallback = null, CancellationToken ct = default)
204208
{
205209
using var _ = await _lock.LockAsync(ct);
206210
var client = await EnsureDaemon(ct);
@@ -216,8 +220,11 @@ public async Task<SyncSessionModel> CreateSyncSession(CreateSyncSessionRequest r
216220
{
217221
Alpha = req.Alpha.MutagenUrl,
218222
Beta = req.Beta.MutagenUrl,
219-
// TODO: probably should set these at some point
220-
Configuration = new Configuration(),
223+
// TODO: probably should add a configuration page for these at some point
224+
Configuration = new Configuration
225+
{
226+
IgnoreVCSMode = IgnoreVCSMode.Ignore,
227+
},
221228
ConfigurationAlpha = new Configuration(),
222229
ConfigurationBeta = new Configuration(),
223230
},

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy