MAUI updates

This commit is contained in:
Dennis Reimann 2025-01-28 20:31:58 +01:00
parent c1400db8a9
commit 68137f96f1
No known key found for this signature in database
GPG Key ID: 5009E1797F03F8D0
8 changed files with 266 additions and 266 deletions

View File

@ -52,185 +52,6 @@ jobs:
run: |
dotnet test -c Release -v n --logger "console;verbosity=normal" BTCPayApp.Tests
build-desktop-win:
runs-on: windows-latest
steps:
# Setup code, .NET and Android
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build win x64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-x64 -c Debug -o publish/win-x64
- name: Build win x86
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-x86 -c Debug -o publish/win-x86
- name: Build win-arm64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-arm64 -c Debug -o publish/win-arm64
- name: Upload artifact win
uses: actions/upload-artifact@v4
with:
name: windows build
path: |
publish/win-x64
publish/win-x86
publish/win-arm64
build-desktop-linux:
runs-on: ubuntu-latest
steps:
# Setup code, .NET and Android
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build linux x64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r linux-x64 -c Debug -o publish/linux-x64
- name: Build linux arm64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r linux-arm64 -c Debug -o publish/linux-arm64
- name: Upload artifact linux
uses: actions/upload-artifact@v4
with:
name: linux build
path: |
publish/linux-x64
publish/linux-arm64
build-desktop-mac:
runs-on: macos-latest
steps:
# Checkout the code
- uses: actions/checkout@v4
with:
submodules: recursive
# Import code-signing certificates
- name: Import Code-Signing Certificates
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_CERT_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_CERT_P12_PASS }}
# Verify imported certificates and extract Developer ID
- name: Find Code Signing Certificate
id: find-cert
run: |
CERT_NAME=$(security find-identity -v -p codesigning | grep "Apple Distribution" | awk -F '"Apple Distribution: ' '{print $2}' | awk -F '"' '{print $1}')
if [ -z "$CERT_NAME" ]; then
echo "No valid Apple Distribution certificate found!"
exit 1
fi
echo "Certificate Name: Apple Distribution: $CERT_NAME"
echo "CERT_NAME=Apple Distribution: $CERT_NAME" >> $GITHUB_ENV
# Setup .NET
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Build the app for macOS architectures
- name: Build mac x64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -c Release --self-contained -r osx-x64 -o publish/osx-x64
- name: Build mac arm64
run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -c Release --self-contained -r osx-arm64 -o publish/osx-arm64
# Create the .app bundle
- name: Create .app bundle for x64
run: |
mkdir -p dist/osx-x64/BTCPayApp.app/Contents/MacOS
mkdir -p dist/osx-x64/BTCPayApp.app/Contents/Resources
ls -lA publish/osx-x64/
cp -R publish/osx-x64/BTCPayApp.Photino dist/osx-x64/BTCPayApp.app/Contents/MacOS/BTCPayApp
#cp -R publish/osx-x64/* dist/osx-x64/BTCPayApp.app/Contents/MacOS/
#mv dist/osx-x64/BTCPayApp.app/Contents/MacOS/BTCPayApp.Photino dist/osx-x64/BTCPayApp.app/Contents/MacOS/BTCPayApp
echo "<?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>CFBundleExecutable</key>
<string>BTCPayApp</string>
<key>CFBundleIdentifier</key>
<string>org.btcpayserver.app</string>
<key>CFBundleName</key>
<string>BTCPay App</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>" > dist/osx-x64/BTCPayApp.app/Contents/Info.plist
cat dist/osx-x64/BTCPayApp.app/Contents/Info.plist
ls -lA dist/osx-x64/BTCPayApp.app/Contents/**
- name: Create .app bundle for arm64
run: |
mkdir -p dist/osx-arm64/BTCPayApp.app/Contents/MacOS
mkdir -p dist/osx-arm64/BTCPayApp.app/Contents/Resources
ls -lA publish/osx-arm64/
cp -R publish/osx-arm64/BTCPayApp.Photino dist/osx-arm64/BTCPayApp.app/Contents/MacOS/BTCPayApp
#cp -R publish/osx-arm64/* dist/osx-arm64/BTCPayApp.app/Contents/MacOS/
#mv dist/osx-arm64/BTCPayApp.app/Contents/MacOS/BTCPayApp.Photino dist/osx-arm64/BTCPayApp.app/Contents/MacOS/BTCPayApp
echo "<?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>CFBundleExecutable</key>
<string>BTCPayApp</string>
<key>CFBundleIdentifier</key>
<string>org.btcpayserver.app</string>
<key>CFBundleName</key>
<string>BTCPay App</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>" > dist/osx-arm64/BTCPayApp.app/Contents/Info.plist
cat dist/osx-arm64/BTCPayApp.app/Contents/Info.plist
ls -lA dist/osx-arm64/BTCPayApp.app/Contents/**
# Sign the .app bundles using the dynamic certificate name
- name: Sign x64 app bundle
run: |
codesign --sign "$CERT_NAME" --deep --force --options runtime dist/osx-x64/BTCPayApp.app
codesign --verify --deep --strict dist/osx-x64/BTCPayApp.app
- name: Sign arm64 app bundle
run: |
codesign --sign "$CERT_NAME" --deep --force --options runtime dist/osx-arm64/BTCPayApp.app
codesign --verify --deep --strict dist/osx-arm64/BTCPayApp.app
# Verify app bundle signing
- name: Verify x64 app bundle signing
run: spctl --assess --type execute dist/osx-x64/BTCPayApp.app
continue-on-error: true
- name: Verify arm64 app bundle signing
run: spctl --assess --type execute dist/osx-arm64/BTCPayApp.app
continue-on-error: true
# Create DMG files
- name: Create DMG for x64
run: |
mkdir -p dmg
hdiutil create -size 1gb -volname "BTCPayApp-osx-x64" -srcfolder "dist/osx-x64" -ov -format UDZO dmg/BTCPayApp-x64.dmg
codesign --sign "$CERT_NAME" --deep --force --options runtime dmg/BTCPayApp-x64.dmg
codesign --verify --deep --strict dmg/BTCPayApp-x64.dmg
- name: Create DMG for arm64
run: |
mkdir -p dmg
hdiutil create -size 1gb -volname "BTCPayApp-osx-arm64" -srcfolder "dist/osx-arm64" -ov -format UDZO dmg/BTCPayApp-arm64.dmg
codesign --sign "$CERT_NAME" --deep --force --options runtime dmg/BTCPayApp-arm64.dmg
codesign --verify --deep --strict dmg/BTCPayApp-arm64.dmg
# Verify DMG signing
- name: Verify x64 DMG signing
run: spctl --assess --type execute dmg/BTCPayApp-x64.dmg
continue-on-error: true
- name: Verify arm64 DMG signing
run: spctl --assess --type execute dmg/BTCPayApp-arm64.dmg
continue-on-error: true
# Upload artifacts
- name: Upload DMG artifacts
uses: actions/upload-artifact@v4
with:
name: mac-dmg
path: dmg
build-android:
runs-on: windows-latest
steps:
@ -245,47 +66,226 @@ jobs:
- name: Install workloads
run: dotnet workload install maui
- name: Build
run: dotnet publish BTCPayApp.Maui/BTCPayApp.Maui.csproj -f net8.0-android -c Debug -o publish/android
run: dotnet publish BTCPayApp.Maui/BTCPayApp.Maui.csproj -f net8.0-android -c Release -o publish/android
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: android build
path: |
publish/android
#
# build-ios:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Setup Xcode version
# uses: maxim-lobanov/setup-xcode@v1.6.0
# with:
# xcode-version: 16.0
# - name: Setup .NET
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
# - name: Install workloads
# run: dotnet workload install maui
# - name: Import Code-Signing Certificates
# uses: Apple-Actions/import-codesign-certs@v1
# with:
# p12-file-base64: ${{ secrets.APPLE_CERT_P12_BASE64 }}
# p12-password: ${{ secrets.APPLE_CERT_P12_PASS }}
# - name: Download Apple Provisioning Profiles
# uses: Apple-Actions/download-provisioning-profiles@v1
# with:
# bundle-id: ${{ secrets.APPLE_BUNDLE_ID }}
# issuer-id: ${{ secrets.APPLE_ISSUER_ID }}
# api-key-id: ${{ secrets.APPLE_KEY_ID }}
# api-private-key: ${{ secrets.APPLE_KEY }}
# - name: Build
# run: dotnet publish BTCPayApp.Maui/BTCPayApp.Maui.csproj -f net8.0-ios -c Debug -o publish/ios
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ios build
# path: |
# publish/ios
# build-desktop-win:
# runs-on: windows-latest
# steps:
# # Setup code, .NET and Android
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Setup .NET
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
# - name: Build win x64
# run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-x64 -c Debug -o publish/win-x64
# - name: Build win x86
# run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-x86 -c Debug -o publish/win-x86
# - name: Build win-arm64
# run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r win-arm64 -c Debug -o publish/win-arm64
# - name: Upload artifact win
# uses: actions/upload-artifact@v4
# with:
# name: windows build
# path: |
# publish/win-x64
# publish/win-x86
# publish/win-arm64
# build-desktop-linux:
# runs-on: ubuntu-latest
# steps:
# # Setup code, .NET and Android
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Setup .NET
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
# - name: Build linux x64
# run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r linux-x64 -c Debug -o publish/linux-x64
# - name: Build linux arm64
# run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -r linux-arm64 -c Debug -o publish/linux-arm64
# - name: Upload artifact linux
# uses: actions/upload-artifact@v4
# with:
# name: linux build
# path: |
# publish/linux-x64
# publish/linux-arm64
# build-desktop-mac:
# runs-on: macos-latest
# steps:
# # Checkout the code
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# # Import code-signing certificates
# - name: Import Code-Signing Certificates
# uses: apple-actions/import-codesign-certs@v3
# with:
# p12-file-base64: ${{ secrets.APPLE_CERT_P12_BASE64 }}
# p12-password: ${{ secrets.APPLE_CERT_P12_PASS }}
# # Verify imported certificates and extract Developer ID
# - name: Find Code Signing Certificate
# id: find-cert
# run: |
# CERT_NAME=$(security find-identity -v -p codesigning | grep "Apple Distribution" | awk -F '"Apple Distribution: ' '{print $2}' | awk -F '"' '{print $1}')
# if [ -z "$CERT_NAME" ]; then
# echo "No valid Apple Distribution certificate found!"
# exit 1
# fi
# echo "Certificate Name: Apple Distribution: $CERT_NAME"
# echo "CERT_NAME=Apple Distribution: $CERT_NAME" >> $GITHUB_ENV
# # Setup .NET
# - name: Setup .NET
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
# # Build the app for macOS architectures
# - name: Build mac x64
# run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -c Release --self-contained -r osx-x64 -o publish/osx-x64
# - name: Build mac arm64
# run: dotnet publish BTCPayApp.Photino/BTCPayApp.Photino.csproj -c Release --self-contained -r osx-arm64 -o publish/osx-arm64
# # Create the .app bundle
# - name: Create .app bundle for x64
# run: |
# mkdir -p dist/osx-x64/BTCPayApp.app/Contents/MacOS
# mkdir -p dist/osx-x64/BTCPayApp.app/Contents/Resources
# ls -lA publish/osx-x64/
# cp -R publish/osx-x64/BTCPayApp.Photino dist/osx-x64/BTCPayApp.app/Contents/MacOS/BTCPayApp
# #cp -R publish/osx-x64/* dist/osx-x64/BTCPayApp.app/Contents/MacOS/
# #mv dist/osx-x64/BTCPayApp.app/Contents/MacOS/BTCPayApp.Photino dist/osx-x64/BTCPayApp.app/Contents/MacOS/BTCPayApp
# echo "<?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>CFBundleExecutable</key>
# <string>BTCPayApp</string>
# <key>CFBundleIdentifier</key>
# <string>org.btcpayserver.app</string>
# <key>CFBundleName</key>
# <string>BTCPay App</string>
# <key>CFBundleVersion</key>
# <string>1.0</string>
# <key>CFBundlePackageType</key>
# <string>APPL</string>
# </dict>
# </plist>" > dist/osx-x64/BTCPayApp.app/Contents/Info.plist
# cat dist/osx-x64/BTCPayApp.app/Contents/Info.plist
# ls -lA dist/osx-x64/BTCPayApp.app/Contents/**
# - name: Create .app bundle for arm64
# run: |
# mkdir -p dist/osx-arm64/BTCPayApp.app/Contents/MacOS
# mkdir -p dist/osx-arm64/BTCPayApp.app/Contents/Resources
# ls -lA publish/osx-arm64/
# cp -R publish/osx-arm64/BTCPayApp.Photino dist/osx-arm64/BTCPayApp.app/Contents/MacOS/BTCPayApp
# #cp -R publish/osx-arm64/* dist/osx-arm64/BTCPayApp.app/Contents/MacOS/
# #mv dist/osx-arm64/BTCPayApp.app/Contents/MacOS/BTCPayApp.Photino dist/osx-arm64/BTCPayApp.app/Contents/MacOS/BTCPayApp
# echo "<?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>CFBundleExecutable</key>
# <string>BTCPayApp</string>
# <key>CFBundleIdentifier</key>
# <string>org.btcpayserver.app</string>
# <key>CFBundleName</key>
# <string>BTCPay App</string>
# <key>CFBundleVersion</key>
# <string>1.0</string>
# <key>CFBundlePackageType</key>
# <string>APPL</string>
# </dict>
# </plist>" > dist/osx-arm64/BTCPayApp.app/Contents/Info.plist
# cat dist/osx-arm64/BTCPayApp.app/Contents/Info.plist
# ls -lA dist/osx-arm64/BTCPayApp.app/Contents/**
# # Sign the .app bundles using the dynamic certificate name
# - name: Sign x64 app bundle
# run: |
# codesign --sign "$CERT_NAME" --deep --force --options runtime dist/osx-x64/BTCPayApp.app
# codesign --verify --deep --strict dist/osx-x64/BTCPayApp.app
# - name: Sign arm64 app bundle
# run: |
# codesign --sign "$CERT_NAME" --deep --force --options runtime dist/osx-arm64/BTCPayApp.app
# codesign --verify --deep --strict dist/osx-arm64/BTCPayApp.app
# # Verify app bundle signing
# - name: Verify x64 app bundle signing
# run: spctl --assess --type execute dist/osx-x64/BTCPayApp.app
# continue-on-error: true
# - name: Verify arm64 app bundle signing
# run: spctl --assess --type execute dist/osx-arm64/BTCPayApp.app
# continue-on-error: true
# # Create DMG files
# - name: Create DMG for x64
# run: |
# mkdir -p dmg
# hdiutil create -size 1gb -volname "BTCPayApp-osx-x64" -srcfolder "dist/osx-x64" -ov -format UDZO dmg/BTCPayApp-x64.dmg
# codesign --sign "$CERT_NAME" --deep --force --options runtime dmg/BTCPayApp-x64.dmg
# codesign --verify --deep --strict dmg/BTCPayApp-x64.dmg
# - name: Create DMG for arm64
# run: |
# mkdir -p dmg
# hdiutil create -size 1gb -volname "BTCPayApp-osx-arm64" -srcfolder "dist/osx-arm64" -ov -format UDZO dmg/BTCPayApp-arm64.dmg
# codesign --sign "$CERT_NAME" --deep --force --options runtime dmg/BTCPayApp-arm64.dmg
# codesign --verify --deep --strict dmg/BTCPayApp-arm64.dmg
# # Verify DMG signing
# - name: Verify x64 DMG signing
# run: spctl --assess --type execute dmg/BTCPayApp-x64.dmg
# continue-on-error: true
# - name: Verify arm64 DMG signing
# run: spctl --assess --type execute dmg/BTCPayApp-arm64.dmg
# continue-on-error: true
# # Upload artifacts
# - name: Upload DMG artifacts
# uses: actions/upload-artifact@v4
# with:
# name: mac-dmg
# path: dmg
#
# build-ios:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Setup Xcode version
# uses: maxim-lobanov/setup-xcode@v1.6.0
# with:
# xcode-version: 16.0
# - name: Setup .NET
# uses: actions/setup-dotnet@v4
# with:
# dotnet-version: 8.0.x
# - name: Install workloads
# run: dotnet workload install maui
# - name: Import Code-Signing Certificates
# uses: Apple-Actions/import-codesign-certs@v1
# with:
# p12-file-base64: ${{ secrets.APPLE_CERT_P12_BASE64 }}
# p12-password: ${{ secrets.APPLE_CERT_P12_PASS }}
# - name: Download Apple Provisioning Profiles
# uses: Apple-Actions/download-provisioning-profiles@v1
# with:
# bundle-id: ${{ secrets.APPLE_BUNDLE_ID }}
# issuer-id: ${{ secrets.APPLE_ISSUER_ID }}
# api-key-id: ${{ secrets.APPLE_KEY_ID }}
# api-private-key: ${{ secrets.APPLE_KEY }}
# - name: Build
# run: dotnet publish BTCPayApp.Maui/BTCPayApp.Maui.csproj -f net8.0-ios -c Debug -o publish/ios
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ios build
# path: |
# publish/ios

View File

@ -1,4 +1,4 @@
<component name="ProjectRunConfigurationManager">
·<component name="ProjectRunConfigurationManager">
<configuration default="false" name="BTCPayApp.Maui" type="XamarinAndroidProject" factoryName="Xamarin.Android">
<option name="PROJECT_PATH" value="$PROJECT_DIR$/BTCPayApp.Maui/BTCPayApp.Maui.csproj" />
<option name="PROGRAM_PARAMETERS" value="" />
@ -15,4 +15,4 @@
<option name="EXTRA_MLAUNCH_PARAMETERS" value="" />
<method v="2" />
</configuration>
</component>
</component>

View File

@ -1,15 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>net8.0-ios;net8.0-android;</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('linux'))">net8.0-android;</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>BTCPayApp.Maui</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<EnableDefaultCssItems>false</EnableDefaultCssItems>
<!-- Display name -->
@ -20,13 +17,12 @@
<ApplicationIdGuid>8DD71ACC-C78F-44AB-937A-6B3A19D7E78E</ApplicationIdGuid>
<RunAOTCompilation>false</RunAOTCompilation>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">23.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">26.0</SupportedOSPlatformVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
@ -36,21 +32,19 @@
<UseInterpreter>True</UseInterpreter>
<EnableAssemblyILStripping>false</EnableAssemblyILStripping>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#FFFFFF"/>
<!-- Images -->
<MauiImage Include="Resources\Images\*"/>
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*"/>
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)"/>
</ItemGroup>
@ -69,12 +63,10 @@
<PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.100"/>
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<Compile Remove="**\iOS\**\*.cs"/>
<None Include="**\iOS\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)"/>
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<Compile Remove="**\Android\**\*.cs"/>
<None Include="**\Android\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)"/>
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.10"/>
@ -82,5 +74,4 @@
<PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.10"/>
<PackageReference Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.10"/>
</ItemGroup>
</Project>
</Project>

View File

@ -1,4 +1,4 @@
#if DEBUG
//#if DEBUG
namespace BTCPayApp.Maui;
@ -11,7 +11,9 @@ public class DangerousHttpClientFactory : IHttpClientFactory
{
public static bool ServerValidate(object sender, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors errors)
{
return certificate?.Issuer.Equals("CN=localhost") is true || errors == SslPolicyErrors.None;
return true;
if (errors == SslPolicyErrors.None) return true;
return certificate?.Subject.Equals("CN=localhost") is true || certificate?.Issuer.Equals("CN=localhost") is true;
}
private static HttpClientHandler GetInsecureHandler()
@ -28,7 +30,7 @@ public class DangerousHttpClientFactory : IHttpClientFactory
}
#if ANDROID
public class DangerousAndroidMessageHandler :Xamarin.Android.Net.AndroidMessageHandler
public class DangerousAndroidMessageHandler : Xamarin.Android.Net.AndroidMessageHandler
{
protected override Javax.Net.Ssl.IHostnameVerifier GetSSLHostnameVerifier(Javax.Net.Ssl.HttpsURLConnection connection)
=> new CustomHostnameVerifier();
@ -37,7 +39,7 @@ public class DangerousAndroidMessageHandler :Xamarin.Android.Net.AndroidMessageH
{
public bool Verify(string? hostname, Javax.Net.Ssl.ISSLSession? session)
{
return session?.PeerPrincipal?.Name == "CN=localhost";
return true;//session?.PeerPrincipal?.Name == "CN=localhost";
}
}
}
@ -49,7 +51,7 @@ public static class DebugExtensions
{
services.Replace(ServiceDescriptor.Singleton<IHttpClientFactory, DangerousHttpClientFactory>());
services.AddSingleton<Func<HttpMessageHandler, HttpMessageHandler>>((handler) =>
services.AddSingleton<Func<HttpMessageHandler, HttpMessageHandler>>(handler =>
{
if (handler is HttpClientHandler clientHandler)
{
@ -59,7 +61,7 @@ public static class DebugExtensions
return clientHandler;
}
#if ANDROID
return new DangerousAndroidMessageHandler();
return new DangerousAndroidMessageHandler();
#else
return handler;
#endif
@ -72,4 +74,4 @@ public static class DebugExtensions
return services;
}
}
#endif
//#endif

View File

@ -38,7 +38,6 @@ public partial class MainPage : ContentPage
e.WebView.Settings.AllowFileAccess = true;
e.WebView.Settings.MediaPlaybackRequiresUserGesture = false;
e.WebView.Settings.SetGeolocationEnabled(true);
e.WebView.Settings.SetGeolocationDatabasePath(e.WebView.Context?.FilesDir?.Path);
e.WebView.SetWebChromeClient(new PermissionManagingBlazorWebChromeClient(e.WebView.WebChromeClient!, activity));
#endif
}

View File

@ -1,6 +1,4 @@
using BTCPayApp.Core;
using BTCPayApp.Core.Contracts;
using BTCPayApp.Maui.Services;
using BTCPayApp.UI;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.LifecycleEvents;
@ -14,24 +12,16 @@ public static class MauiProgram
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>()
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); });
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.Services.AddMauiBlazorWebView();
builder.Services.ConfigureBTCPayAppCore();
builder.Services.AddBTCPayAppUIServices();
builder.Services.AddLogging(loggingBuilder => loggingBuilder
.AddConsole()
);
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
builder.Logging.AddDebug();
#endif
builder.Services.AddSingleton<IDataDirectoryProvider, MauiDataDirectoryProvider>();
builder.Services.AddSingleton<ISecureConfigProvider, MauiEssentialsSecureConfigProvider>();
builder.Services.AddSingleton<ISystemThemeProvider, MauiSystemThemeProvider>();
builder.Services.AddSingleton(CrossFingerprint.Current);
builder.Services.AddSingleton<HostedServiceInitializer>();
builder.Services.AddSingleton<IMauiInitializeService, HostedServiceInitializer>();
builder.Services.ConfigureBTCPayAppCore();
builder.Services.ConfigureBTCPayAppMaui();
builder.Services.AddLogging(loggingBuilder => loggingBuilder.AddConsole());
builder.ConfigureLifecycleEvents(events =>
{
@ -49,8 +39,6 @@ public static class MauiProgram
{
IPlatformApplication.Current?.Services.GetRequiredService<HostedServiceInitializer>().Dispose();
}));
#endif
#if IOS
events.AddiOS(ios => ios
@ -72,10 +60,11 @@ public static class MauiProgram
return true;
}
});
#if DEBUG
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
builder.Services.AddDangerousSSLSettingsForDev();
#endif
builder.Logging.AddDebug();
#endif
return builder.Build();
}
}

View File

@ -0,0 +1,19 @@
using BTCPayApp.Core.Contracts;
using BTCPayApp.Maui.Services;
using Plugin.Fingerprint;
namespace BTCPayApp.Maui;
public static class StartupExtensions
{
public static IServiceCollection ConfigureBTCPayAppMaui(this IServiceCollection serviceCollection)
{
serviceCollection.AddSingleton<IDataDirectoryProvider, MauiDataDirectoryProvider>();
serviceCollection.AddSingleton<ISecureConfigProvider, MauiEssentialsSecureConfigProvider>();
serviceCollection.AddSingleton<ISystemThemeProvider, MauiSystemThemeProvider>();
serviceCollection.AddSingleton(CrossFingerprint.Current);
serviceCollection.AddSingleton<HostedServiceInitializer>();
serviceCollection.AddSingleton<IMauiInitializeService, HostedServiceInitializer>();
return serviceCollection;
}
}

View File

@ -147,7 +147,7 @@
<symbol id="warning" viewBox="0 0 24 24" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.2528 5.32603C12.2282 5.28043 12.1917 5.24233 12.1472 5.21577C12.1027 5.18922 12.0518 5.1752 12 5.1752C11.9482 5.1752 11.8973 5.18922 11.8528 5.21577C11.8083 5.24233 11.7718 5.28043 11.7472 5.32603L4.75786 18.4014C4.73445 18.4451 4.72276 18.4942 4.72393 18.5438C4.7251 18.5934 4.7391 18.6419 4.76455 18.6844C4.79001 18.727 4.82606 18.7623 4.86919 18.7868C4.91233 18.8113 4.96107 18.8242 5.01068 18.8243H18.9893C19.0389 18.8242 19.0877 18.8113 19.1308 18.7868C19.1739 18.7623 19.21 18.727 19.2354 18.6844C19.2609 18.6419 19.2749 18.5934 19.2761 18.5438C19.2772 18.4942 19.2656 18.4451 19.2421 18.4014L12.2528 5.32603ZM10.2268 4.51356C10.9841 3.09547 13.0159 3.09547 13.7732 4.51356L20.7625 17.5889C20.9263 17.8953 21.0079 18.2389 20.9994 18.5862C20.9909 18.9335 20.8926 19.2727 20.714 19.5707C20.5354 19.8687 20.2827 20.1154 19.9804 20.2867C19.6782 20.458 19.3367 20.548 18.9893 20.5481H5.01068C4.66327 20.548 4.3218 20.458 4.01955 20.2867C3.7173 20.1154 3.46457 19.8687 3.286 19.5707C3.10743 19.2727 3.0091 18.9335 3.0006 18.5862C2.9921 18.2389 3.07372 17.8953 3.2375 17.5889L10.2268 4.51356ZM13.1492 15.9514C13.1492 16.2561 13.0281 16.5484 12.8126 16.764C12.5971 16.9795 12.3048 17.1005 12 17.1005C11.6952 17.1005 11.4029 16.9795 11.1874 16.764C10.9719 16.5484 10.8508 16.2561 10.8508 15.9514C10.8508 15.6466 10.9719 15.3543 11.1874 15.1388C11.4029 14.9233 11.6952 14.8022 12 14.8022C12.3048 14.8022 12.5971 14.9233 12.8126 15.1388C13.0281 15.3543 13.1492 15.6466 13.1492 15.9514ZM12.8619 9.91816C12.8619 9.68957 12.7711 9.47035 12.6094 9.30871C12.4478 9.14708 12.2286 9.05627 12 9.05627C11.7714 9.05627 11.5522 9.14708 11.3906 9.30871C11.2289 9.47035 11.1381 9.68957 11.1381 9.91816V12.7911C11.1381 13.0197 11.2289 13.2389 11.3906 13.4006C11.5522 13.5622 11.7714 13.653 12 13.653C12.2286 13.653 12.4478 13.5622 12.6094 13.4006C12.7711 13.2389 12.8619 13.0197 12.8619 12.7911V9.91816Z" fill="currentColor"/></symbol>
</svg>
<div class="status-bar-safe-area"></div>
<div id="app">Loading...</div>
<div id="app"></div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a class="reload" href="/">Reload</a>