Checking for updates...
;
+ }
+
+ if (error) {
+ return (
+
+
Update Available!
+
Version {updateInfo.version} is available
+
Size: {updateInfo.hasPatch
+ ? `${(updateInfo.patchSize / 1024).toFixed(0)} KB (patch)`
+ : `${(updateInfo.size / 1024 / 1024).toFixed(1)} MB`}
+
+
+
+
+
+ );
+}
+```
+
+## Update Strategies
+
+### Check on Startup
+
+```go
+func (a *App) OnStartup(ctx context.Context) {
+ // Check for updates after a short delay
+ go func() {
+ time.Sleep(5 * time.Second)
+ info, err := a.updater.CheckForUpdate()
+ if err == nil && info != nil {
+ // Emit event to frontend
+ application.Get().EmitEvent("update-available", info)
+ }
+ }()
+}
+```
+
+### Background Checking
+
+Configure automatic background checks:
+
+```go
+updater, _ := application.CreateUpdaterService(
+ "1.0.0",
+ application.WithUpdateURL("https://updates.example.com/myapp/"),
+ application.WithCheckInterval(6 * time.Hour), // Check every 6 hours
+)
+```
+
+### Manual Check Menu Item
+
+```go
+menu := application.NewMenu()
+menu.Add("Check for Updates...").OnClick(func(ctx *application.Context) {
+ info, err := updater.CheckForUpdate()
+ if err != nil {
+ application.InfoDialog().SetMessage("Error checking for updates").Show()
+ return
+ }
+ if info == nil {
+ application.InfoDialog().SetMessage("You're up to date!").Show()
+ return
+ }
+ // Show update dialog...
+})
+```
+
+## Delta Updates (Patches)
+
+Delta updates (patches) allow users to download only the changes between versions, dramatically reducing download sizes.
+
+### How It Works
+
+1. When building a new version, generate patches from previous versions
+2. Host patches alongside full updates on your server
+3. The updater automatically downloads patches when available
+4. If patching fails, it falls back to the full download
+
+### Generating Patches
+
+Patches are generated using the bsdiff algorithm. You'll need the `bsdiff` tool:
+
+```bash
+# Install bsdiff (macOS)
+brew install bsdiff
+
+# Install bsdiff (Ubuntu/Debian)
+sudo apt-get install bsdiff
+
+# Generate a patch
+bsdiff old-binary new-binary patch.bsdiff
+```
+
+### Patch File Naming
+
+Organize your patches in your update directory:
+
+```
+updates/
+├── update.json
+├── myapp-1.2.0-macos-arm64.tar.gz
+├── myapp-1.2.0-windows-amd64.zip
+└── patches/
+ ├── 1.0.0-to-1.2.0-macos-arm64.patch
+ ├── 1.1.0-to-1.2.0-macos-arm64.patch
+ ├── 1.0.0-to-1.2.0-windows-amd64.patch
+ └── 1.1.0-to-1.2.0-windows-amd64.patch
+```
+
+