mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-15 15:15:51 +01:00
This commit adds comprehensive Android support for Wails v3, enabling Go applications to run as native Android apps with WebView-based UI. Key features: - Android-specific application implementation with JNI bridge - WebView integration via WebViewAssetLoader for serving assets - JavaScript runtime injection and execution via JNI callbacks - Binding call support with async result callbacks - Event system support for Android platform - Full example Android app with Gradle build system Technical details: - Uses CGO with Android NDK for cross-compilation - Implements JNI callbacks for Go <-> Java communication - Supports both ARM64 and x86_64 architectures - WebView debugging support via Chrome DevTools Protocol - Handles empty response body case in binding calls to prevent panic Files added: - v3/pkg/application/*_android.go - Android platform implementations - v3/pkg/events/events_android.go - Android event definitions - v3/internal/*/\*_android.go - Android-specific internal packages - v3/examples/android/ - Complete example Android application - v3/ANDROID_ARCHITECTURE.md - Architecture documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
//go:build linux && !android
|
|
|
|
package operatingsystem
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// platformInfo is the platform specific method to get system information
|
|
func platformInfo() (*OS, error) {
|
|
_, err := os.Stat("/etc/os-release")
|
|
if os.IsNotExist(err) {
|
|
return nil, fmt.Errorf("unable to read system information")
|
|
}
|
|
|
|
osRelease, _ := os.ReadFile("/etc/os-release")
|
|
return parseOsRelease(string(osRelease)), nil
|
|
}
|
|
|
|
func parseOsRelease(osRelease string) *OS {
|
|
|
|
// Default value
|
|
var result OS
|
|
result.ID = "Unknown"
|
|
result.Name = "Unknown"
|
|
result.Version = "Unknown"
|
|
|
|
// Split into lines
|
|
lines := strings.Split(osRelease, "\n")
|
|
// Iterate lines
|
|
for _, line := range lines {
|
|
// Split each line by the equals char
|
|
splitLine := strings.SplitN(line, "=", 2)
|
|
// Check we have
|
|
if len(splitLine) != 2 {
|
|
continue
|
|
}
|
|
switch splitLine[0] {
|
|
case "ID":
|
|
result.ID = strings.ToLower(strings.Trim(splitLine[1], `"`))
|
|
case "NAME":
|
|
result.Name = strings.Trim(splitLine[1], `"`)
|
|
case "VERSION_ID":
|
|
result.Version = strings.Trim(splitLine[1], `"`)
|
|
case "VERSION":
|
|
result.Branding = strings.Trim(splitLine[1], `"`)
|
|
}
|
|
}
|
|
return &result
|
|
}
|