Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,73 @@ jobs:
path: '*.tar.gz'
if-no-files-found: error

# macOS ships as a Mac Catalyst app, not a plain net10.0 desktop build: InTheHand.BluetoothLE
# only has its CoreBluetooth backend for maccatalyst (plain net10.0 means BlueZ, Linux-only).
# Both architectures on one Apple Silicon runner (Intel macOS runner images are retired);
# the .app is ad-hoc signed, which is enough for it to start on Apple Silicon.
#
# Disabled for now: there is no Mac to try the app on yet. To turn it back on, drop the
# `if:` below and add build-macos back to the `needs:` of prerelease and release.
build-macos:
name: Build macOS (osx-arm64, osx-x64)
if: ${{ false }}
runs-on: macos-26
needs: [version]
env:
VERSION: ${{ needs.version.outputs.version }}
VERSION_SUFFIX: ${{ needs.version.outputs.version_suffix }}
MACCATALYST_PROJECT: Letra200bSharp.Avalonia.MacCatalyst/Letra200bSharp.Avalonia.MacCatalyst.csproj

steps:
- uses: actions/checkout@v7
with:
persist-credentials: false

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: 'ga'

- name: Cache NuGet
uses: actions/cache@v6
with:
path: ${{ env.NUGET_PACKAGES }}
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', 'Directory.Packages.props', 'Directory.Build.props', 'BuildVersion.props') }}
restore-keys: nuget-${{ runner.os }}-

# android: the shared Letra200bSharp library also targets net10.0-android.
- name: Install maccatalyst and android workloads
run: dotnet workload install maccatalyst android

- name: Publish and package Mac Catalyst app
run: |
for ARCH in arm64 x64; do
dotnet publish "$MACCATALYST_PROJECT" \
-c Release \
-f net10.0-maccatalyst \
-r "maccatalyst-$ARCH" \
-p:VersionSuffix="$VERSION_SUFFIX" \
-p:ContinuousIntegrationBuild=true
APP=$(find Letra200bSharp.Avalonia.MacCatalyst/bin/Release/net10.0-maccatalyst/maccatalyst-$ARCH \
-maxdepth 1 -name '*.app' -type d | head -n1)
if [ -z "$APP" ]; then
echo "::error::No .app produced for maccatalyst-$ARCH"
exit 1
fi
codesign --verify --verbose "$APP"
# ditto keeps the bundle's symlinks, extended attributes and signature intact.
ditto -c -k --keepParent "$APP" "Letra200bSharp-${VERSION}-osx-${ARCH}.zip"
done
ls -lh Letra200bSharp-*.zip

- name: Upload macOS artifact
uses: actions/upload-artifact@v7
with:
name: desktop-osx
path: '*.zip'
if-no-files-found: error

build-android:
name: Build Android APK
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
then duplicates them and D8 fails. Pin core-ktx to the matching 1.19 stub. -->
<PackageVersion Include="Xamarin.AndroidX.Core.Core.Ktx" Version="1.19.1" />

<!-- letra200bsharp.Avalonia.MacCatalyst -->
<PackageVersion Include="Avalonia.iOS" Version="$(AvaloniaVersion)" />

<!-- letra200bsharp.Avalonia.Desktop -->
<PackageVersion Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
Expand Down
17 changes: 17 additions & 0 deletions Letra200bSharp.Avalonia.MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Avalonia;
using Avalonia.iOS;
using Foundation;

namespace Letra200bSharp.Avalonia.MacCatalyst;

// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from the OS.
[Register("AppDelegate")]
public partial class AppDelegate : AvaloniaAppDelegate<App>
{
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder);
}
}
26 changes: 26 additions & 0 deletions Letra200bSharp.Avalonia.MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?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>
<key>CFBundleDisplayName</key>
<string>Label Studio 200B</string>
<!-- 6 = "Optimize for Mac": the app's views are laid out 1:1 instead of scaled from an iPad layout. -->
<key>UIDeviceFamily</key>
<array>
<integer>6</integer>
</array>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<!-- Required by CoreBluetooth: without it macOS terminates the app on the first scan. -->
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Label Studio 200B uses Bluetooth to find and print to your LetraTag 200B label printer.</string>
<key>UIRequiresFullScreen</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- macOS head. Mac Catalyst rather than a plain net10.0 desktop build because
InTheHand.BluetoothLE only ships its CoreBluetooth backend for maccatalyst/ios: on
plain net10.0 it falls back to BlueZ (Linux only), so a net10.0 macOS build could
never scan for or print to the LetraTag. -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-maccatalyst</TargetFramework>
<!-- Mac Catalyst 15.0 = macOS 12 Monterey. -->
<SupportedOSPlatformVersion>15.0</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationId>com.Letra200bSharp.Avalonia</ApplicationId>
<ApplicationTitle>Label Studio 200B</ApplicationTitle>
<!-- Names the bundle (LabelStudio200B.app); the namespace stays Letra200bSharp.*. -->
<AssemblyName>LabelStudio200B</AssemblyName>
<ApplicationVersion>$(VersionPrefix)</ApplicationVersion>
<ApplicationDisplayVersion>$(VersionPrefix)</ApplicationDisplayVersion>
<Product>Label Studio 200B</Product>
<AssemblyTitle>Label Studio 200B</AssemblyTitle>
<!-- Distributed as a plain .app outside the App Store: no installer package and an
ad-hoc signature (enough for Apple Silicon to run it; no Developer ID needed). -->
<CreatePackage>false</CreatePackage>
<EnableCodeSigning>true</EnableCodeSigning>
<CodesignKey>-</CodesignKey>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.iOS" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Letra200bSharp.Avalonia\Letra200bSharp.Avalonia.csproj" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions Letra200bSharp.Avalonia.MacCatalyst/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using UIKit;

namespace Letra200bSharp.Avalonia.MacCatalyst;

public static class Program
{
// This is the main entry point of the application.
public static void Main(string[] args)
{
// "AppDelegate" is registered with the Objective-C runtime by [Register] above.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
7 changes: 4 additions & 3 deletions Letra200bSharp.Avalonia/ViewModels/AboutTabViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ private static IReadOnlyList<AboutLinkItem> BuildLibraries()
new("SkiaSharp", "https://github.com/mono/SkiaSharp", "Image processing - resizing/thresholding source images, rendering text and barcodes, generating label previews"),
new("InTheHand.BluetoothLE", "https://github.com/inthehand/32feet", "Cross-platform Bluetooth LE scanning and GATT communication with the printer"),
new("CodeGlyphX", "https://github.com/EvotecIT/CodeGlyphX", "Encoding 1D (Code128, Code39, EAN/UPC, ...) and 2D (QR, Micro QR, rMQR, Data Matrix) barcode data into the module pattern printed on the label"),
new("Avalonia", "https://avaloniaui.net/", "Cross-platform UI framework behind the desktop and Android apps"),
new("Avalonia", "https://avaloniaui.net/", "Cross-platform UI framework behind the desktop, macOS and Android apps"),
new("Avalonia Cascadia Theme", "https://github.com/simonebortolin/CascadiaUI", "The app's visual theme - light/dark styling, toast notifications, busy overlays"),
new("CommunityToolkit.Mvvm", "https://learn.microsoft.com/en-gb/dotnet/communitytoolkit/", "MVVM boilerplate - source-generated observable properties and relay commands"),
};

// Only the Android head lacks a CLI entirely - both desktop TFMs (Windows and Linux) build it in.
if (!OperatingSystem.IsAndroid())
// Only the Android and Mac Catalyst (macOS) heads lack a CLI entirely - both desktop
// TFMs (Windows and Linux) build it in. IsIOS() is also true on Mac Catalyst.
if (!OperatingSystem.IsAndroid() && !OperatingSystem.IsIOS())
{
libraries.Add(new("CommandLineParser", "https://github.com/commandlineparser/commandline", "Parsing arguments in the desktop app's headless CLI mode"));
}
Expand Down
3 changes: 3 additions & 0 deletions Letra200bSharp.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<Deploy Solution="*|Any CPU" />
</Project>
<Project Path="Letra200bSharp.Avalonia.Desktop/Letra200bSharp.Avalonia.Desktop.csproj" />
<Project Path="Letra200bSharp.Avalonia.MacCatalyst/Letra200bSharp.Avalonia.MacCatalyst.csproj">
<Deploy Solution="*|Any CPU" />
</Project>
<Project Path="Letra200bSharp.Avalonia/Letra200bSharp.Avalonia.csproj" />
<Project Path="Letra200bSharp/Letra200bSharp.csproj" />
</Solution>
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ C# library and mobile and desktop applications for printing images to a Dymo Let
- Protocol for communicating with the device
- **Letra200bSharp.Avalonia** is a cross-platform Avalonia application with a tab each for printing an image, text, or a 1D barcode label, plus a **History** tab that keeps the last 50 successful prints (with a thumbnail) and lets you reprint a text or barcode job with one tap. Follows the system's light/dark theme and adapts its layout to the available width, from phone to desktop
- **Letra200bSharp.Avalonia.Desktop** is the Windows/Linux desktop app. Launched with no arguments it opens the GUI; launched with arguments it instead runs headless as a CLI, with one verb per tab - `image`, `text`, `barcode` - plus `list-devices` to scan for nearby printers (run with `--help`, or `<verb> --help`, for the full option list)
- **Letra200bSharp.Avalonia.MacCatalyst** is the macOS app (Mac Catalyst, `osx-arm64` and `osx-x64`; not built by CI or released yet, as it hasn't been tried on a Mac). It is a Mac Catalyst head rather than a `net10.0` desktop build because InTheHand.BluetoothLE only ships its CoreBluetooth backend for `maccatalyst`/`ios`; it has the GUI only, no CLI. The `.app` is ad-hoc signed, not notarized: on first launch right-click it and choose **Open** (or run `xattr -dr com.apple.quarantine LabelStudio200B.app`)
- **Letra200bSharp.Avalonia.Android** is a Avalonia android mobile application that easily lets you select a device and an image, text or barcode label for sending to the LetraTag 200B

## Screenshots
Expand All @@ -26,7 +27,7 @@ Each row shows the phone (light/dark) and desktop (light/dark) apps for that tab

## Used libraries
- [SkiaSharp](https://github.com/mono/SkiaSharp) for all image processing - resizing/thresholding source images, rendering text and barcodes to a bitmap, and generating the label previews
- [InTheHand.BluetoothLE](https://github.com/inthehand/32feet) for cross-platform Bluetooth LE scanning and GATT communication with the printer (Windows, Linux, Android)
- [InTheHand.BluetoothLE](https://github.com/inthehand/32feet) for cross-platform Bluetooth LE scanning and GATT communication with the printer (Windows, Linux, macOS, Android)
- [CodeGlyphX](https://github.com/EvotecIT/CodeGlyphX) for encoding barcode data into the module pattern rendered onto the label - both 1D (Code128, Code39, Codabar, ITF, EAN/UPC, ...) and 2D (QR, Micro QR, rMQR, Data Matrix)
- [Avalonia](https://avaloniaui.net/) as the cross-platform UI framework behind the desktop and Android apps
- [Avalonia Cascadia Theme](https://github.com/simonebortolin/CascadiaUI) for the app's visual theme - light/dark styling, the toast notifications, and the busy/loading overlay on the label previews
Expand Down
Loading