Skip to content

feat(ui): add macOS version with Avalonia UI - #174

Open
ertugrulkutluer wants to merge 1 commit into
vinaghost:mainfrom
ertugrulkutluer:feat/macos-avalonia-ui
Open

ertugrulkutluer wants to merge 1 commit into
vinaghost:mainfrom
ertugrulkutluer:feat/macos-avalonia-ui

Conversation

@ertugrulkutluer

@ertugrulkutluer ertugrulkutluer commented Oct 14, 2026 •

Copy link
Copy Markdown

Summary

This adds a macOS version of TBS. WPFUI only runs on Windows, so this PR adds AvaloniaUI, a port of the same views to Avalonia 12 + ReactiveUI. It reuses the existing MainCore view models unchanged, so bot logic stays shared between both UIs.

Changes

  • AvaloniaUI/ (new): every WPFUI view, user control and converter ported 1:1, with the same ReactiveUI bindings in code-behind.
    • The UI starts on the process main thread; macOS only allows windows there, which is why the WPF hosting package's dedicated UI thread is not used.
    • ReactiveUI is registered once, straight into the Microsoft DI container (Splat resolver).
    • Material icons became text labels ("Save", "Start", ...). The WPF MessageBox / file dialogs are replaced with Avalonia equivalents.
  • MainCore (Windows behaviour unchanged):
    • MainViewModel.CheckDriver: still uses the registry on Windows; on macOS it reads the Chrome version from /Applications/Google Chrome.app.
    • MainCore.csproj: RuntimeIdentifier, SelfContained and PlaywrightPlatform are now only set on Windows, so the project restores on macOS (Patchright then picks osx-arm64 itself).
    • AppPaths: data root is still AppContext.BaseDirectory on Windows; on macOS it is ~/Library/Application Support/TravianBotSharp (an app bundle is not a good place for the DB, logs and Chrome profiles).
  • build-mac.sh: builds a self-contained publish/TravianBotSharp.app.
  • release.yml: new BuildMac job on macos-latest that attaches TBS-<version>-macOS.zip to the release. The Windows build and its zip name are unchanged.
  • README: macOS install/build instructions.

Testing

Tested on macOS 26 (Apple Silicon), Chrome 155:

  • The app starts, loads all tabs and closes cleanly (Cmd+Q / SIGTERM shut the browsers down first).
  • Login to a live account, village/building update and "build all resources to level 10" all ran on macOS.
  • Simulated the release steps locally (VERSION=1.2.3 ./build-mac.sh + ditto zip).

Not tested: building on Windows. All changes are meant to keep WPFUI behaviour identical, but a Windows build check would be appreciated. The new release job has not run on GitHub Actions yet.

Notes

  • The macOS app is ad-hoc signed, not notarized, so users have to run xattr -dr com.apple.quarantine TravianBotSharp.app once (documented in the README). Notarization would need an Apple Developer account.
  • Avalonia also runs on Windows, so WPFUI could eventually be replaced by a single UI. That is your call; this PR keeps both.

Add AvaloniaUI, a cross-platform port of WPFUI that reuses the
MainCore view models, so TBS can run on macOS.

- AvaloniaUI: every WPFUI view ported to Avalonia 12 + ReactiveUI.
  The UI runs on the process main thread, which macOS requires.
- MainCore: detect Chrome on macOS, keep Windows-only build settings
  conditional, and store data in ~/Library/Application Support on
  macOS. Windows behaviour is unchanged.
- build-mac.sh: builds a self-contained TravianBotSharp.app.
- release.yml: build the macOS app on macos-latest and attach
  TBS-<version>-macOS.zip to the release. The Windows zip is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vinaghost

vinaghost commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

first of all, thank for your PR.

Last time I checked, it was necessary to pay for a sign from Apple to run application on their machine,
are they changed their policy ?
i will check the rest later today,

@ertugrulkutluer

Copy link
Copy Markdown
Author

Thanks! No, the policy hasn't changed, but paying is only needed to avoid the warning, not to run the app.

  • Without a paid Apple Developer certificate the app gets a free ad-hoc signature (build-mac.sh does this). That is enough to run on Apple Silicon.
  • When it's downloaded, macOS blocks it the first time because it isn't notarized. The user allows it once (System Settings > Privacy & Security > "Open Anyway", or xattr -dr com.apple.quarantine TravianBotSharp.app) and after that it opens normally.
  • Building it locally with build-mac.sh doesn't even show the warning.

The $99/year signing + notarization would only remove that one-time prompt. It's optional; I described both options in the README.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need update on other 2 workflows

Comment thread AvaloniaUI/App.axaml.cs

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use https://github.com/reactivemarbles/Extensions.Hosting on WPF project, and there is Avalonia support

Comment thread MainCore/Services/ChromeBrowser.cs
Comment thread MainCore/MainCore.csproj

@vinaghost vinaghost Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last time without <PlaywrightPlatform> it didn't filter driver and put all platform into the driver folder, do we need to specific macos to help that ?

Comment thread README.md

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to update the guide, macOS doesn't run .exe right ?

@vinaghost vinaghost left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave some comment please check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants