Project migration to new model with Android support (will be rebased) #337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The intention of this PR is to upgrade the project/solution to the newer model allowing for both Desktop and Android builds.
And while an android build can now be compiled, it is not completely usable. This is intended to create the base for a future android build while testing everything still works as expected with the desktop versions, not to produce a working android build.
Android specific work can start after this one is merged.
Changes:
With the change to the new model, now to compile a desktop build, the Knossos.NET.Desktop project must be used, and now has options to use NET6 or NET8. The idea is to keep using NET 6 for desktop builds. But this is now something that has to be selected.
The resulting executable file is now called "Knossos.NET.Desktop.exe" i dont really want to use that, so they have to be renamed to "Knossos.NET.exe" changing the assembly name creates lots of problems and even then the compiled still did not changed the name. SO it will be better to either accept the new name or to rename the executable.
The second issue is, as android is single view and can not create windows, i had to take petty much everything away from the main window view and model and move it into "MainView" and "MainViewModel", this could create significant issues so everything that runs on the main view need to be tested again. And thats include custom mode.
All dialogs that created new windows, like MessageBox and everything on Views/Windows with the exception of MainWindow and SapiVoices(Windows specific), were moved to a new type called "KnossosWindow", now these dialogs were changed from Window to KnossosWindow, that extend UserControl, this new system add stuff we used from Window that was missing on UserControl, and on a Desktop OS will create a new Window as normal, but on Android it will display the view in a overlay over the MainView.
No need to say this means all dialogs that created new window could have potential issues, altrought i havent found anything so far.
Auto update need to be tested again with both executable names, ill figure a way to do that.
The integrated github build will need to be adjusted to this model too.
Compiling:
To compile a desktop version as before, you must use the Knossos.NET.Desktop project, to compile the Android version, choose the Knossos.NET.Android (only from cmdline, not from VS)
Build and publish the desktop version for windows x64 in net 6 or 8:
dotnet build Knossos.NET.Desktop -c Release -r win-x64 -f net6.0
dotnet build Knossos.NET.Desktop -c Release -r win-x64 -f net8.0
dotnet publish Knossos.NET.Desktop -c Release -r win-x64 -f net6.0 --self-contained
dotnet publish Knossos.NET.Desktop -c Release -r win-x64 -f net8.0 --self-contained
Build the Android version:
dotnet build Knossos.NET.Android -c Release -f net8.0-Android
That creates a signed apk for all cpu archs ready to install in any device that is android 9+, no need to use publish for this.
Compile and upload to phone directly for development:
dotnet run -c Debug -f net8.0-Android
Run from inside the Knossos.NET.Android folder, not the solution folder as before, phone needs to be on developer mode, with usb debugging enabled and adb daemon needs to be already running on your pc, so make sure to start it manually first.
When working with android apps i also recommend to use "scrcpy"
https://github.com/Genymobile/scrcpy/releases/tag/v3.3.3
scrcpy will connect to the phone using adb and it will start the daemon too, so you can see and use everything directly on your pc without having to pickup the phone or do anything with it