Skip to content

A Swiss Army knife for developers.

Fixed Mac app and MAUI on Mac

Etienne Baudoux67a21b869398
diff --git a/src/DevToys-MacOS.sln b/src/DevToys-MacOS.sln
index 066b11f73..5b4fe80b6 100644
--- a/src/DevToys-MacOS.sln
+++ b/src/DevToys-MacOS.sln
@@ -63,6 +63,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.MacOS", "app\dev\pl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.MauiBlazor", "app\dev\platforms\desktop\DevToys.MauiBlazor\DevToys.MauiBlazor.csproj", "{77A35152-832A-47FA-B7B8-2B0E113E8B29}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "generators", "generators", "{1713A47C-7BCA-4240-8CD6-7A047E377801}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResxHelperGenerator", "generators\ResxHelperGenerator\ResxHelperGenerator.csproj", "{F404CCE2-597A-485A-B70A-C119E5CC12ED}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevToys.Localization", "app\dev\DevToys.Localization\DevToys.Localization.csproj", "{A3ABEA5E-48FB-45D5-98D4-042D3DEA53E7}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AnyCPU = Debug|AnyCPU
@@ -117,6 +123,15 @@ Global
{77A35152-832A-47FA-B7B8-2B0E113E8B29}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{77A35152-832A-47FA-B7B8-2B0E113E8B29}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{77A35152-832A-47FA-B7B8-2B0E113E8B29}.Release|AnyCPU.Build.0 = Release|Any CPU
+ {77A35152-832A-47FA-B7B8-2B0E113E8B29}.Debug|AnyCPU.Deploy.0 = Debug|Any CPU
+ {F404CCE2-597A-485A-B70A-C119E5CC12ED}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
+ {F404CCE2-597A-485A-B70A-C119E5CC12ED}.Debug|AnyCPU.Build.0 = Debug|Any CPU
+ {F404CCE2-597A-485A-B70A-C119E5CC12ED}.Release|AnyCPU.ActiveCfg = Release|Any CPU
+ {F404CCE2-597A-485A-B70A-C119E5CC12ED}.Release|AnyCPU.Build.0 = Release|Any CPU
+ {A3ABEA5E-48FB-45D5-98D4-042D3DEA53E7}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
+ {A3ABEA5E-48FB-45D5-98D4-042D3DEA53E7}.Debug|AnyCPU.Build.0 = Debug|Any CPU
+ {A3ABEA5E-48FB-45D5-98D4-042D3DEA53E7}.Release|AnyCPU.ActiveCfg = Release|Any CPU
+ {A3ABEA5E-48FB-45D5-98D4-042D3DEA53E7}.Release|AnyCPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -141,6 +156,8 @@ Global
{9E59352A-836D-47DE-AB02-F404A8345242} = {04F9E03E-B519-49C5-BC6A-2131ED9BADC0}
{E3E689D3-FC5E-48B4-961E-DD5C0DB62DAF} = {8B003389-15D4-4466-A40E-50FC0D603BF6}
{77A35152-832A-47FA-B7B8-2B0E113E8B29} = {22EE9386-CEFA-47D8-97B2-09A63EDF7F2E}
+ {F404CCE2-597A-485A-B70A-C119E5CC12ED} = {1713A47C-7BCA-4240-8CD6-7A047E377801}
+ {A3ABEA5E-48FB-45D5-98D4-042D3DEA53E7} = {B20E4027-0777-4A75-A848-609594E9A6B0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C2C953F5-F97F-4198-B15C-4947A886050F}
diff --git a/src/app/dev/DevToys.MonacoEditor/highlightjs/Highlighter.cs b/src/app/dev/DevToys.MonacoEditor/highlightjs/Highlighter.cs
index cded5481f..f31e89f4c 100644
--- a/src/app/dev/DevToys.MonacoEditor/highlightjs/Highlighter.cs
+++ b/src/app/dev/DevToys.MonacoEditor/highlightjs/Highlighter.cs
@@ -60,7 +60,7 @@ internal sealed class Highlighter
var window = JSValue.CreateObject(_jsContext);
_jsContext[new NSString("window")] = window;
- string highlightJsScript = await HighlightJsScript.Task;
+ string highlightJsScript = await HighlightJsScript.GetValueAsync();
JSValue? value = _jsContext.EvaluateScript(highlightJsScript);
if (value is not null && value.ToBool())
@@ -77,7 +77,7 @@ internal sealed class Highlighter
/// <returns>true if it was possible to set the given theme, false otherwise</returns>
private async Task SetThemeAsync()
{
- string contentsOfFile = await VisualStudioTheme.Task;
+ string contentsOfFile = await VisualStudioTheme.GetValueAsync();
_theme = new Theme(contentsOfFile);
}
diff --git a/src/app/dev/DevToys.UI.Framework/Controls/BackdropPage.cs b/src/app/dev/DevToys.UI.Framework/Controls/BackdropPage.cs
index 29267efc6..a04808c41 100644
--- a/src/app/dev/DevToys.UI.Framework/Controls/BackdropPage.cs
+++ b/src/app/dev/DevToys.UI.Framework/Controls/BackdropPage.cs
@@ -9,7 +9,7 @@ using WindowActivatedEventArgs = Microsoft.UI.Xaml.WindowActivatedEventArgs;
namespace DevToys.UI.Framework.Controls;
-public abstract class BackdropPage : Page
+public abstract partial class BackdropPage : Page
{
private readonly IThemeListener _themeListener;
diff --git a/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.MacCatalyst.cs b/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.MacCatalyst.cs
index 5ff8125e7..2128cf0a1 100644
--- a/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.MacCatalyst.cs
+++ b/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.MacCatalyst.cs
@@ -15,17 +15,17 @@ public sealed partial class BackdropWindow
public partial void Resize(int width, int height)
{
- throw new NotImplementedException(); // TODO.
+ // throw new NotImplementedException(); // TODO.
}
public partial void Move(int x, int y)
{
- throw new NotImplementedException(); // TODO.
+ // throw new NotImplementedException(); // TODO.
}
public partial void Show()
{
- throw new NotImplementedException(); // TODO.
+ // throw new NotImplementedException(); // TODO.
Window.Activate();
Shown?.Invoke(this, EventArgs.Empty);
@@ -33,24 +33,24 @@ public sealed partial class BackdropWindow
private void SetStartupWindowLocation()
{
- throw new NotImplementedException(); // TODO
- switch (WindowStartupLocation)
- {
- case WindowStartupLocation.CenterOwner:
- // TODO
- throw new NotImplementedException();
-
- case WindowStartupLocation.CenterScreen:
- // TODO
- throw new NotImplementedException();
-
- case WindowStartupLocation.Manual:
- // Let the OS decide for us.
- break;
-
- default:
- throw new NotSupportedException();
- }
+ // throw new NotImplementedException(); // TODO
+ // switch (WindowStartupLocation)
+ // {
+ // case WindowStartupLocation.CenterOwner:
+ // // TODO
+ // throw new NotImplementedException();
+ //
+ // case WindowStartupLocation.CenterScreen:
+ // // TODO
+ // throw new NotImplementedException();
+ //
+ // case WindowStartupLocation.Manual:
+ // // Let the OS decide for us.
+ // break;
+ //
+ // default:
+ // throw new NotSupportedException();
+ // }
}
}
#endif
diff --git a/src/app/dev/DevToys.UI/Views/MainWindow.xaml b/src/app/dev/DevToys.UI/Views/MainWindow.xaml
index 0709bef4f..7566be45d 100644
--- a/src/app/dev/DevToys.UI/Views/MainWindow.xaml
+++ b/src/app/dev/DevToys.UI/Views/MainWindow.xaml
@@ -13,7 +13,7 @@
xmlns:not_win="http://uno.ui/not_win"
mc:Ignorable="d wasm not_win macos ios">
- <Grid not_win:Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
+ <Grid not_win:Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" ios:Margin="0,38,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="*"/>
@@ -27,5 +27,6 @@
<Button Content="Hello world" Grid.Column="0"/>
<Grid x:Name="DraggableArea" Grid.Column="1" controls:BackdropWindow.IsWindowDraggableArea="True"/>
</Grid>
+ <Button Content="Hello world" Grid.Column="0"/>
</Grid>
</controls:BackdropPage>
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj
index 97688bf0f..6e2aff806 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj
@@ -29,9 +29,9 @@
<When Condition="'$(TargetFramework)' == '$(NetMacCatalyst)'">
<PropertyGroup>
<DefineConstants>$(DefineConstants);__MACCATALYST__</DefineConstants>
- <RuntimeIdentifiers>maccatalyst-arm64;maccatalyst-x64</RuntimeIdentifiers>
+ <RuntimeIdentifiers>maccatalyst-arm64</RuntimeIdentifiers>
</PropertyGroup>
- <PropertyGroup Condition="'$(RuntimeIdentifier)'==''">
+ <PropertyGroup Condition="'$(RuntimeIdentifier)'=='' AND '$(Configuration)'=='Release'">
<!-- Default values for command line builds -->
<RuntimeIdentifier>maccatalyst-arm64</RuntimeIdentifier>
</PropertyGroup>
@@ -76,10 +76,17 @@
<!-- TypeScript -->
<ConfigFiles Include="tsconfig.json" />
+ <Content Update="tsconfig.json" PublishFolderType="None" />
<TypeScriptCompile Remove="**\*.ts" />
<None Include="**\*.ts" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="..\..\..\DevToys.MonacoEditor\monaco-editor\*" LinkBase="wwwroot\lib\monaco-editor\%(RecursiveDir)/%(Filename)%(Extension)" />
+ <Content Include="..\..\..\DevToys.MonacoEditor\monaco-editor\min\**\*" Link="wwwroot\lib\monaco-editor\min\%(RecursiveDir)/%(Filename)%(Extension)" />
+ <TypeScriptCompile Remove="wwwroot\lib\monaco-editor\**\*.*" />
+ </ItemGroup>
+
<ItemGroup>
<ProjectReference Include="..\..\..\DevToys.Api\DevToys.Api.csproj" />
<ProjectReference Include="..\..\..\DevToys.Core\DevToys.Core.csproj" />
@@ -95,10 +102,4 @@
</PackageReference>
</ItemGroup>
- <ItemGroup>
- <Content Include="..\..\..\DevToys.MonacoEditor\monaco-editor\*" LinkBase="wwwroot\lib\monaco-editor\%(RecursiveDir)/%(Filename)%(Extension)" />
- <Content Include="..\..\..\DevToys.MonacoEditor\monaco-editor\min\**\*" Link="wwwroot\lib\monaco-editor\min\%(RecursiveDir)/%(Filename)%(Extension)" />
- <TypeScriptCompile Remove="wwwroot\lib\monaco-editor\**\*.*" />
- </ItemGroup>
-
</Project>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/Info.plist b/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/Info.plist
index 8fc8e692d..a43fd92d7 100755
--- a/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/Info.plist
+++ b/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/Info.plist
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
-<dict>
+ <dict>
<key>CFBundleName</key>
<string>DevToys</string>
<key>CFBundleDisplayName</key>
@@ -22,15 +22,22 @@
<string>LaunchScreen</string>
<key>UISupportedInterfaceOrientations</key>
<array>
- <string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Media.xcassets/AppIcon.appiconset</string>
<key>UIAppFonts</key>
<array>
- <string>Fonts/uno-fluentui-assets.ttf</string>
+ <string>Fonts/uno-fluentui-assets.ttf</string>
</array>
-</dict>
+
+ <!--
+ Adjust this to your application's encryption usage.
+ <key>ITSAppUsesNonExemptEncryption</key>
+ <false/>
+ -->
+
+ </dict>
</plist>
diff --git a/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/LaunchScreen.storyboard b/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/LaunchScreen.storyboard
index 04a81ae75..649c461a2 100755
--- a/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/LaunchScreen.storyboard
+++ b/src/app/dev/platforms/desktop/macos/DevToys.MacOS/MacCatalyst/LaunchScreen.storyboard
@@ -1,10 +1,12 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="5" launchScreen="YES">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="5">
+ <device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
+ <!--View Controller-->
<scene sceneID="4">
<objects>
<viewController id="5" sceneMemberID="viewController">
@@ -12,41 +14,31 @@
<viewControllerLayoutGuide type="top" id="2"/>
<viewControllerLayoutGuide type="bottom" id="3"/>
</layoutGuides>
- <view contentMode="scaleToFill" id="55" key="view">
- <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+ <view key="view" contentMode="scaleToFill" id="55">
+ <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" colorSpace="custom" customColorSpace="sRGB" red="1" green="1" blue="1" alpha="1"/>
<subviews>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="56" translatesAutoresizingMaskIntoConstraints="NO" image="SplashScreen.png">
- <rect key="frame" x="58" y="120" width="204" height="242"/>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SplashScreen.png" translatesAutoresizingMaskIntoConstraints="NO" id="56">
+ <rect key="frame" x="94.666666666666686" y="305" width="204" height="242"/>
<constraints>
- <constraint id="91" firstItem="56" firstAttribute="width" constant="204"/>
- <constraint id="92" firstItem="56" firstAttribute="height" constant="242"/>
+ <constraint firstAttribute="width" constant="204" id="91"/>
+ <constraint firstAttribute="height" constant="242" id="92"/>
</constraints>
</imageView>
</subviews>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
- <constraint id="80" firstItem="55" firstAttribute="centerY" secondItem="56" secondAttribute="centerY" constant="0"/>
- <constraint id="81" firstItem="55" firstAttribute="centerX" secondItem="56" secondAttribute="centerX" constant="0"/>
+ <constraint firstAttribute="centerY" secondItem="56" secondAttribute="centerY" id="80"/>
+ <constraint firstAttribute="centerX" secondItem="56" secondAttribute="centerX" id="81"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="-300" y="-555"/>
+ <point key="canvasLocation" x="-458.01526717557249" y="-390.84507042253523"/>
</scene>
</scenes>
<resources>
- <image name="[email protected]" width="40" height="40"/>
- <image name="[email protected]" width="60" height="60"/>
- <image name="[email protected]" width="76" height="76"/>
- <image name="[email protected]" width="40" height="40"/>
- <image name="Icon-Small.png" width="29" height="29"/>
<image name="SplashScreen.png" width="620" height="300"/>
</resources>
- <simulatedMetricsContainer key="defaultSimulatedMetrics">
- <simulatedStatusBarMetrics key="statusBar"/>
- <simulatedOrientationMetrics key="orientation"/>
- <simulatedScreenMetrics key="destination"/>
- </simulatedMetricsContainer>
</document>
diff --git a/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
index 810538429..63b9723cf 100644
--- a/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
+++ b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
@@ -6,6 +6,7 @@
<NoWarn>NU1701</NoWarn>
<WasmPWAManifestFile>manifest.json</WasmPWAManifestFile>
<DefineConstants>__WASM__</DefineConstants>
+ <BaseIntermediateOutputPath>..\..\..\..\..\..\obj\AnyCPU\DevToys.Wasm</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
@@ -66,5 +67,13 @@
<ProjectReference Include="..\..\..\DevToys.UI\DevToys.UI.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <Compile Update="..\..\desktop\windows\DevToys.Wasdk\Core\Settings\SettingsStorage.cs">
+ <Link>Core\Settings\\SettingsStorage.cs</Link>
+ </Compile>
+ <Compile Update="..\..\desktop\windows\DevToys.Wasdk\Core\Theme\ThemeListener.cs">
+ <Link>Core\Theme\\ThemeListener.cs</Link>
+ </Compile>
+ </ItemGroup>
<Import Project="$(RepoRoot)\src\app\dev\shared\App.props" />
</Project>
\ No newline at end of file
diff --git a/src/app/dev/platforms/web/DevToys.Wasm/Properties/launchSettings.json b/src/app/dev/platforms/web/DevToys.Wasm/Properties/launchSettings.json
index 7abaaba5c..3476260f6 100644
--- a/src/app/dev/platforms/web/DevToys.Wasm/Properties/launchSettings.json
+++ b/src/app/dev/platforms/web/DevToys.Wasm/Properties/launchSettings.json
@@ -1,30 +1,29 @@
{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:8080",
+ "sslPort": 0
+ }
+ },
"profiles": {
"DevToys.Wasm": {
"commandName": "Project",
"launchBrowser": true,
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
+ "applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- },
- "dotnetRunMessages": true,
- "applicationUrl": "http://localhost:5000",
- "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
+ }
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- },
- "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
- }
- },
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:8080",
- "sslPort": 0
+ }
}
}
}
\ No newline at end of file
diff --git a/src/app/dev/shared/App.xaml.cs b/src/app/dev/shared/App.xaml.cs
index 05c44b2ac..4188f2150 100644
--- a/src/app/dev/shared/App.xaml.cs
+++ b/src/app/dev/shared/App.xaml.cs
@@ -96,7 +96,7 @@ public sealed partial class App : Application
#elif __MACCATALYST__
// Important! Keep the full name `Microsoft.UI.Xaml.Window.Current` otherwise the Mac app won't build.
// See https://blog.mzikmund.com/2020/04/resolving-uno-platform-uiwindow-does-not-contain-a-definition-for-current-issue/
- _mainWindow = new MainWindow(new BackdropWindow(Microsoft.UI.Xaml.Window.Current), themeListener);
+ MainWindow = new MainWindow(new BackdropWindow(Microsoft.UI.Xaml.Window.Current), themeListener);
#else
MainWindow = new MainWindow(new BackdropWindow(Window.Current), themeListener);
#endif