refactor(arch): split App into shared library + Desktop + Android heads
The Avalonia UI code (App, Views, ViewModels, Localization, Assets) now lives in src/App as a plain library (no OutputType). Two thin heads reference it: - src/App.Desktop/ — WinExe, Avalonia.Desktop, hosts MainView in a MainWindow; carries Program.cs and app.manifest (moved from src/App) - src/App.Android/ — net10.0-android, Avalonia.Android, MainActivity/ MainApplication; targets API 23+, EmbedAssembliesIntoApk=true so the apk is self-contained for sideloading All event handlers and TopLevel-dependent calls (file picker, clipboard, folder picker) moved from MainWindow.axaml.cs into the new shared MainView.axaml.cs (UserControl), using TopLevel.GetTopLevel(this) so they work on both platforms. Esc/Back key handling is also in MainView. MainWindow becomes a thin shell that hosts MainView. Framework bump: all projects move to net10.0; Cli and Tests follow.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
using Avalonia;
|
||||
using Avalonia.Android;
|
||||
using PalladiumWallet.Core.Storage;
|
||||
|
||||
namespace PalladiumWallet.Mobile;
|
||||
|
||||
// In Avalonia 12 l'AppBuilder Android si configura nella sottoclasse Application
|
||||
// (AvaloniaAndroidApplication<TApp>), non più nell'Activity. allowBackup=false:
|
||||
// il file wallet cifrato/seed non deve finire nei backup cloud automatici.
|
||||
[Application(Label = "Palladium Wallet", AllowBackup = false)]
|
||||
public class MainApplication : AvaloniaAndroidApplication<global::PalladiumWallet.App.App>
|
||||
{
|
||||
public MainApplication(IntPtr javaReference, JniHandleOwnership transfer)
|
||||
: base(javaReference, transfer)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnCreate()
|
||||
{
|
||||
// Storage sandbox dell'app: wallet, configurazione e certificati vivono
|
||||
// qui. Impostato prima dell'init Avalonia (che crea il ViewModel e decide
|
||||
// se mostrare lo step "scegli cartella dati" del wizard).
|
||||
AppPaths.OverrideDataRoot = FilesDir?.AbsolutePath;
|
||||
base.OnCreate();
|
||||
}
|
||||
|
||||
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) =>
|
||||
base.CustomizeAppBuilder(builder).WithInterFont();
|
||||
}
|
||||
Reference in New Issue
Block a user