-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply feedback from user testing (#1384)
* prevent throwing any errors when trying to acquire an oauth token * only show staging server in prod maui builds * allow clicking on synced server projects to open them, change `Syncing with..` to `Synced with` * prep history service to be called from frontend * remove code clearing out MiniLcm service when home page is loaded * rework project providers * provide history service via project view * don't throw an error when deleting an example or sense which hasn't been created yet * replace Entry, Sense with Word and Definition in WeSay and LF views * add close button to drawer * fix open in flex on maui * fix Toc links taking you home * workaround bug in window.Activate not bringing the window to the front
- Loading branch information
Showing
53 changed files
with
689 additions
and
307 deletions.
There are no files selected for viewing
This file contains 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,9 @@ | ||
namespace FwDataMiniLcmBridge.LcmUtils; | ||
|
||
public static class FwLink | ||
{ | ||
public static string ToEntry(Guid entryId, string projectName) | ||
{ | ||
return $"silfw://localhost/link?database={projectName}&tool=lexiconEdit&guid={entryId}"; | ||
} | ||
} |
This file contains 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
24 changes: 23 additions & 1 deletion
24
backend/FwLite/FwLiteMaui/Platforms/Windows/WindowsKernel.cs
This file contains 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 |
---|---|---|
@@ -1,22 +1,44 @@ | ||
using System.Runtime.InteropServices; | ||
using FwLiteShared; | ||
using FwLiteShared.Auth; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Maui.Platform; | ||
|
||
namespace FwLiteMaui; | ||
|
||
public static class WindowsKernel | ||
{ | ||
|
||
public static void AddFwLiteWindows(this IServiceCollection services, IHostEnvironment environment) | ||
{ | ||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return; | ||
services.AddSingleton<IMauiInitializeService, AppUpdateService>(); | ||
services.AddSingleton<IMauiInitializeService, AppUpdateService>(); | ||
if (!FwLiteMauiKernel.IsPortableApp) | ||
{ | ||
services.AddSingleton<IMauiInitializeService, WindowsShortcutService>(); | ||
} | ||
|
||
services.Configure<AuthConfig>(config => | ||
{ | ||
config.AfterLoginWebView = () => | ||
{ | ||
var window = Application.Current?.Windows.FirstOrDefault()?.Handler?.PlatformView as Microsoft.UI.Xaml.Window; | ||
if (window is null) throw new InvalidOperationException("Could not find window"); | ||
//note, window.Activate() does not work per https://github.com/microsoft/microsoft-ui-xaml/issues/7595 | ||
var hwnd = window.GetWindowHandle(); | ||
WindowHelper.SetForegroundWindow(hwnd); | ||
}; | ||
}); | ||
|
||
services.Configure<FwLiteConfig>(config => | ||
{ | ||
config.UseDevAssets = environment.IsDevelopment(); | ||
}); | ||
} | ||
} | ||
|
||
public class WindowHelper | ||
{ | ||
[DllImport("user32.dll")] | ||
public static extern void SetForegroundWindow(IntPtr hWnd); | ||
} |
This file contains 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,40 @@ | ||
#if INCLUDE_FWDATA_BRIDGE | ||
using FwDataMiniLcmBridge; | ||
using FwDataMiniLcmBridge.LcmUtils; | ||
using FwLiteShared.Services; | ||
using Microsoft.JSInterop; | ||
|
||
namespace FwLiteMaui.Services; | ||
|
||
public class AppLauncher(FwDataFactory fwDataFactory, FieldWorksProjectList projectList) : IAppLauncher | ||
{ | ||
private readonly ILauncher _launcher = Launcher.Default; | ||
|
||
[JSInvokable] | ||
public Task<bool> CanOpen(string uri) | ||
{ | ||
return _launcher.CanOpenAsync(uri); | ||
} | ||
|
||
[JSInvokable] | ||
public Task Open(string uri) | ||
{ | ||
return _launcher.OpenAsync(uri); | ||
} | ||
|
||
[JSInvokable] | ||
public Task<bool> TryOpen(string uri) | ||
{ | ||
return _launcher.TryOpenAsync(uri); | ||
} | ||
|
||
[JSInvokable] | ||
public Task<bool> OpenInFieldWorks(Guid entryId, string projectName) | ||
{ | ||
var project = projectList.GetProject(projectName); | ||
if (project is null) return Task.FromResult(false); | ||
fwDataFactory.CloseProject(project); | ||
return _launcher.TryOpenAsync(FwLink.ToEntry(entryId, projectName)); | ||
} | ||
} | ||
#endif |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,32 +1,8 @@ | ||
@page "/project/{projectName}" | ||
@using FwLiteShared.Layout | ||
@using FwLiteShared.Services | ||
@using Microsoft.Extensions.DependencyInjection | ||
@inherits OwningComponentBaseAsync | ||
@layout SvelteLayout; | ||
@inject IJSRuntime JS; | ||
@* injecting here means we get a provider scoped to the current circuit *@ | ||
@inject FwLiteProvider FwLiteProvider; | ||
|
||
@code { | ||
|
||
[Parameter] | ||
public required string ProjectName { get; set; } | ||
|
||
private IAsyncDisposable? _disposable; | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (!firstRender) return; | ||
//scoped services here are per page render, meaning they will get cleaned up when the page is disposed | ||
_disposable = await FwLiteProvider.InjectCrdtProject(JS, ScopedServices, ProjectName); | ||
} | ||
|
||
protected override async ValueTask DisposeAsyncCore() | ||
{ | ||
//sadly this is not called when the page is left, not sure how we can fix that yet | ||
await base.DisposeAsyncCore(); | ||
if (_disposable is not null) | ||
await _disposable.DisposeAsync(); | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,31 +1,10 @@ | ||
@page "/fwdata/{projectName}" | ||
@using FwLiteShared.Layout | ||
@using FwLiteShared.Services | ||
@using Microsoft.Extensions.DependencyInjection | ||
@inherits OwningComponentBaseAsync | ||
@layout SvelteLayout; | ||
@inject IJSRuntime JS; | ||
@inject FwLiteProvider FwLiteProvider; | ||
|
||
@code { | ||
|
||
[Parameter] | ||
public required string ProjectName { get; set; } | ||
|
||
private IAsyncDisposable? _disposable; | ||
|
||
protected override Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (!firstRender) return Task.CompletedTask; | ||
_disposable = FwLiteProvider.InjectFwDataProject(ScopedServices, ProjectName); | ||
return Task.CompletedTask; | ||
} | ||
|
||
protected override async ValueTask DisposeAsyncCore() | ||
{ | ||
await base.DisposeAsyncCore(); | ||
if (_disposable is not null) | ||
await _disposable.DisposeAsync(); | ||
} | ||
|
||
} |
This file contains 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.