Skip to content
Draft
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: 52 additions & 15 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -38,13 +38,28 @@ jobs:

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

# MSBuild evaluates the bundled-runtime Content glob when the project loads.
# Install into a clean checkout before restore/build, not in an MSBuild target.
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: tools/read-along/package-lock.json

- name: Install Read Along runtime
run: npm ci --prefix tools/read-along

- name: Test Read Along playback and persistence
run: dotnet run --project Audibly.ReadAlong.Tests

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v2


# Restore the application to populate the obj folder with RuntimeIdentifiers
Expand All @@ -55,52 +70,74 @@ jobs:

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx
id: signing
env:
SIGNING_CERTIFICATE: ${{ secrets.Base64_Encoded_Pfx }}
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$certificatePath = Join-Path -Path $env:Project_Directory -ChildPath Audibly.App_TemporaryKey.pfx
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
if ($env:SIGNING_CERTIFICATE) {
$pfx_cert_byte = [System.Convert]::FromBase64String($env:SIGNING_CERTIFICATE)
$certificatePath = Join-Path -Path $env:Project_Directory -ChildPath Audibly.App_TemporaryKey.pfx
[IO.File]::WriteAllBytes($certificatePath, $pfx_cert_byte)
"enabled=true" >> $env:GITHUB_OUTPUT
} else {
"enabled=false" >> $env:GITHUB_OUTPUT
}

# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
run: msbuild $env:Solution_Name /p:AppxBundlePlatforms="$env:Appx_Bundle_Platforms" /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=Audibly.App_TemporaryKey.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
run: |
$signing = @('/p:AppxPackageSigningEnabled=false')
if ('${{ steps.signing.outputs.enabled }}' -eq 'true') {
$signing = @('/p:AppxPackageSigningEnabled=true', '/p:PackageCertificateKeyFile=Audibly.App_TemporaryKey.pfx')
}
msbuild $env:Solution_Name /p:AppxBundlePlatforms="$env:Appx_Bundle_Platforms" /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true @signing
env:
Appx_Bundle: Never
Appx_Bundle_Platforms: x64
Appx_Package_Build_Mode: SideloadOnly
Appx_Package_Dir: Packages\
Appx_Package_Dir: ${{ github.workspace }}/artifacts/msix-build/
Configuration: ${{ matrix.configuration }}

# Publishing with WindowsPackageType=None can clean earlier package outputs.
# Keep the release payload outside MSBuild's tracked output directories.
- name: Stage app package
run: |
New-Item -ItemType Directory -Path artifacts/release -Force | Out-Null
$packages = @(Get-ChildItem artifacts/msix-build -Filter 'Audibly.App*.msix' -Recurse -File)
if ($packages.Count -eq 0) { throw 'The application MSIX was not produced.' }
$packages | Copy-Item -Destination artifacts/release

# Remove the pfx
# - name: Remove the pfx
# run: Remove-Item -path $env:Wap_Project_Directory\$env:Signing_Certificate

# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload build artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: MSIX Package
path: Audibly.App/Packages/**/Audibly.App*.msix
path: artifacts/release/Audibly.App*.msix



# Create the unpackaged app
- name: Build unpackaged app
run: msbuild $env:Solution_Name /t:Publish /p:WindowsPackageType=None /p:Configuration=$env:Configuration /p:Platform=x64
run: msbuild "$env:Project_Directory/Audibly.App.csproj" /t:Publish /p:WindowsPackageType=None /p:Configuration=$env:Configuration /p:Platform=x64 /p:RuntimeIdentifier=win-x64 /p:PublishDir="$env:GITHUB_WORKSPACE/artifacts/unpackaged/"
env:
Configuration: ${{ matrix.configuration }}

- name: Create ZIP of unpackaged app
run: Compress-Archive Audibly.App/bin/x64/Release/net8.0-windows10.0.19041.0/publish/* 'Audibly.App-unpackaged-0.${{ github.run_number }}.${{ github.run_attempt }}.0.zip'
run: Compress-Archive artifacts/unpackaged/* 'Audibly.App-unpackaged-0.${{ github.run_number }}.${{ github.run_attempt }}.0.zip'

- name: Upload unpackaged app
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: 'Unpackaged app'
path: 'Audibly.App-unpackaged-0.${{ github.run_number }}.${{ github.run_attempt }}.0.zip'


- name: Create GH release
if: github.ref_name == 'main'
if: github.ref_name == 'main' && steps.signing.outputs.enabled == 'true'
uses: softprops/action-gh-release@v1
with:
draft: false
Expand All @@ -109,6 +146,6 @@ jobs:
tag_name: 'v0.${{ github.run_number }}.${{ github.run_attempt }}.0'
body: 'To install the MSIX version, you first have to add the certificate included in the MSIX (only need to do that once). To install the unpackaged version, you need to install the x64 WinAppRuntime Installer.'
files: |
Audibly.App/Packages/**/Audibly.App*.msix
artifacts/release/Audibly.App*.msix
Audibly.App-unpackaged-*.zip
fail_on_unmatched_files: true
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,10 @@ MigrationBackup/

# Fody - auto-generated XML schema
FodyWeavers.xsd

# Read Along local research and dependencies
.research/
.dotnet/
.nuget/
tools/read-along/sample/
*.tgz
4 changes: 2 additions & 2 deletions Audibly.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
WindowHelper.CloseAll();
};
appWindow.Title = "Audibly — Audiobook Player";
appWindow.SetIcon("Assets/logo.ico");
appWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets", "logo.ico"));

win32WindowHelper = new Win32WindowHelper(Window);
win32WindowHelper.SetWindowMinMaxSize(new Win32WindowHelper.POINT { x = 940, y = 640 });
Expand Down Expand Up @@ -456,4 +456,4 @@ public static TEnum GetEnum<TEnum>(string text) where TEnum : struct
throw new InvalidOperationException("Generic parameter 'TEnum' must be an enum.");
return (TEnum)Enum.Parse(typeof(TEnum), text);
}
}
}
32 changes: 32 additions & 0 deletions Audibly.App/Audibly.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<!-- Toolkit packages require WinRT.Runtime 2.2 (older SDKs choose 2.1). -->
<WindowsSdkPackageVersion>10.0.19041.56</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Audibly.App</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>Assets\logo.ico</ApplicationIcon>
<Platforms>x86;x64;ARM64</Platforms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
Expand Down Expand Up @@ -78,6 +81,7 @@
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
<Content Include="Assets\*.png" Exclude="@(Content)" />
<Content Update="Assets\PayPal_Monogram_Full_Color_RGB.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down Expand Up @@ -105,6 +109,7 @@
<Content Update="Assets\logo.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\*.png" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -150,6 +155,7 @@
<ItemGroup>
<ProjectReference Include="..\Audibly.Models\Audibly.Models.csproj" />
<ProjectReference Include="..\Audibly.Repository\Audibly.Repository.csproj" />
<ProjectReference Include="..\Audibly.ReadAlong\Audibly.ReadAlong.csproj" />
</ItemGroup>
<ItemGroup>
<Page Update="Views\ControlPages\ChangelogDialogContent.xaml">
Expand Down Expand Up @@ -258,6 +264,32 @@
</Page>
</ItemGroup>

<!-- Ship the local alignment runtime with the app, including dependency licence notices.
Models are downloaded to the user's cache on first use, never into the package. -->
<ItemGroup>
<Content Include="..\tools\read-along\align.mjs;..\tools\read-along\convert.mjs;..\tools\read-along\prepare-epub.mjs;..\tools\read-along\package.json;..\tools\read-along\package-lock.json">
<Link>read-along\%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include="..\tools\read-along\node_modules\**\*">
<Link>read-along\node_modules\%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<Target Name="CheckReadAlongRuntime" BeforeTargets="PrepareForBuild" Condition="'$(DesignTimeBuild)' != 'true'">
<Error Condition="!Exists('..\tools\read-along\node_modules\node\bin\node.exe') Or !Exists('..\tools\read-along\node_modules\@storyteller-platform\align\package.json')"
Text="Prepare bundled Read Along dependencies before building: npm ci --prefix tools/read-along (from the repository root)." />
Comment on lines +281 to +283
</Target>
<!-- Runtime files are ordinary package payload, not localized UI resources.
Otherwise names such as dist-es and is-stream become language qualifiers. -->
<Target Name="ExcludeReadAlongFromResourceIndex" AfterTargets="GetPriOutputs">
<ItemGroup>
<PriOutputs Remove="@(PriOutputs)" Condition="$([System.String]::Copy('%(PriOutputs.FullPath)').Contains('\read-along\'))" />
</ItemGroup>
</Target>

<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
Expand Down
37 changes: 37 additions & 0 deletions Audibly.App/Helpers/ReadAlongAppearanceSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Text.Json;
using Windows.Storage;
using Windows.UI;
using Audibly.ReadAlong;

namespace Audibly.App.Helpers;

public static class ReadAlongAppearanceSettings
{
public static event EventHandler? Changed;
public static ReadingPreferences Current { get; private set; } = Load();
private static ReadingPreferences Load()
{
try
{
if (ApplicationData.Current.LocalSettings.Values["ReadAlongAppearance"] is string json)
return (JsonSerializer.Deserialize<ReadingPreferences>(json) ?? new()).Normalize();
}
catch (JsonException) { }
var defaults = new ReadingPreferences();
if (ApplicationData.Current.LocalSettings.Values["MiniReadAlongFontSize"] is double size)
defaults = defaults with { MiniFontSize = size };
return defaults.Normalize();
}
public static void Update(ReadingPreferences value)
{
Current = value.Normalize();
ApplicationData.Current.LocalSettings.Values["ReadAlongAppearance"] = JsonSerializer.Serialize(Current);
Changed?.Invoke(null, EventArgs.Empty);
}
public static Color Color(string value)
{
var rgb = Convert.ToUInt32(value[1..], 16);
return Windows.UI.Color.FromArgb(255, (byte)(rgb >> 16), (byte)(rgb >> 8), (byte)rgb);
}
}
11 changes: 7 additions & 4 deletions Audibly.App/Helpers/WindowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ public static void ShowMiniPlayer()
{
(miniPlayerWindow.AppWindow.Presenter as OverlappedPresenter)?.Restore();
miniPlayerWindow.AppWindow.IsShownInSwitchers = true;
miniPlayerWindow.Activate();

HideMainWindow();
return;
}

miniPlayerWindow = CreateWindow("MiniPlayerWindow");
miniPlayerWindow.CustomizeWindow(648, !MicaController.IsSupported() ? 92 : 96, true, true, false, false, false);
miniPlayerWindow.CustomizeWindow(688, 320, true, true, false, false, false);

var rootPage = new NewMiniPlayerPage();
miniPlayerWindow.Content = rootPage;
Expand All @@ -67,14 +68,16 @@ public static void ShowMiniPlayer()

(miniPlayerWindow as MainWindow)?.TrySetSystemBackdrop();

miniPlayerWindow.SetWindowDraggable(true);
// Drag only the explicit handle. Capturing the whole page interferes
// with word links, text selection and playback controls.
rootPage.ConfigureWindow(miniPlayerWindow);
miniPlayerWindow.RemoveWindowBorderAndTitleBar();

miniPlayerWindow.Activate();
miniPlayerWindow.AppWindow.IsShownInSwitchers = true;

miniPlayerWindow.AppWindow.Title = "Audibly — Audiobook Player";
miniPlayerWindow.AppWindow.SetIcon("Assets/logo.ico");
miniPlayerWindow.AppWindow.SetIcon(System.IO.Path.Combine(AppContext.BaseDirectory, "Assets", "logo.ico"));

HideMainWindow();
}
Expand Down Expand Up @@ -158,4 +161,4 @@ public static StorageFolder GetAppLocalFolder()
localFolder = ApplicationData.Current.LocalFolder;
return localFolder;
}
}
}
1 change: 1 addition & 0 deletions Audibly.App/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<uap:FileTypeAssociation Name="m4b">
<uap:SupportedFileTypes>
<uap:FileType>.m4b</uap:FileType>
<uap:FileType>.m4a</uap:FileType>
</uap:SupportedFileTypes>
<uap:DisplayName>Audiobook Player</uap:DisplayName>
<uap:EditFlags OpenIsSafe="true"/>
Expand Down
3 changes: 2 additions & 1 deletion Audibly.App/Services/FileImportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public async Task ImportDirectoryAsync(string path, CancellationToken cancellati

var files = Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories)
.Where(file => file.EndsWith(".m4b", StringComparison.OrdinalIgnoreCase) ||
file.EndsWith(".m4a", StringComparison.OrdinalIgnoreCase) ||
file.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase))
.ToList();
var numberOfFiles = files.Count;
Expand Down Expand Up @@ -436,4 +437,4 @@ await App.Repository.Audiobooks.GetByTitleAuthorComposerAsync(track.Title, track
return null;
}
}
}
}
22 changes: 19 additions & 3 deletions Audibly.App/UserControls/PlayerControlGrid.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@
Orientation="Horizontal"
VerticalAlignment="Top">

<ToggleButton
Background="Transparent"
BorderThickness="0"
AutomationProperties.AutomationId="ReadAlongToggle"
AutomationProperties.Name="Read Along"
IsChecked="{x:Bind PlayerViewModel.IsReadAlongActive, Mode=OneWay}"
IsEnabled="{x:Bind vm:Converters.IsNotNull(PlayerViewModel.NowPlaying), Mode=OneWay}"
Click="ReadAlongToggle_Click"
ToolTipService.ToolTip="Read Along">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE8F1;" FontSize="16" />
</ToggleButton>
<!--#region VolumeLevelButton-->
<Button
Background="Transparent"
Expand Down Expand Up @@ -334,10 +345,15 @@
</Grid>

<!-- play & skip buttons -->
<local:PlaySkipButtonsStack
<StackPanel
Grid.Column="1"
Grid.Row="1"
HorizontalAlignment="Center" />
HorizontalAlignment="Center"
Orientation="Horizontal"
Spacing="16">
<local:PlaySkipButtonsStack />

</StackPanel>

<!-- now playing bar -->
<local:NowPlayingBar
Expand All @@ -360,4 +376,4 @@
<!-- </VisualState> -->
<!-- </VisualStateGroup> -->
<!-- </VisualStateManager.VisualStateGroups> -->
</UserControl>
</UserControl>
Loading