mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +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>
90 lines
2.1 KiB
Go
90 lines
2.1 KiB
Go
//go:build android
|
|
|
|
package application
|
|
|
|
// dialogsImpl implements dialogs for Android
|
|
type dialogsImpl struct {
|
|
// Android-specific fields if needed
|
|
}
|
|
|
|
func newDialogsImpl() *dialogsImpl {
|
|
return &dialogsImpl{}
|
|
}
|
|
|
|
// Android dialog implementations would use AlertDialog
|
|
// These are placeholder implementations for now
|
|
|
|
func (d *dialogsImpl) info(id uint, param MessageDialogOptions) {
|
|
// TODO: Implement using AlertDialog
|
|
}
|
|
|
|
func (d *dialogsImpl) warning(id uint, param MessageDialogOptions) {
|
|
// TODO: Implement using AlertDialog
|
|
}
|
|
|
|
func (d *dialogsImpl) error(id uint, param MessageDialogOptions) {
|
|
// TODO: Implement using AlertDialog
|
|
}
|
|
|
|
func (d *dialogsImpl) question(id uint, param MessageDialogOptions) chan bool {
|
|
// TODO: Implement using AlertDialog
|
|
ch := make(chan bool, 1)
|
|
ch <- false
|
|
return ch
|
|
}
|
|
|
|
func (d *dialogsImpl) openFile(id uint, param OpenFileDialogOptions) chan string {
|
|
// TODO: Implement using Android file picker intent
|
|
ch := make(chan string, 1)
|
|
ch <- ""
|
|
return ch
|
|
}
|
|
|
|
func (d *dialogsImpl) openMultipleFiles(id uint, param OpenFileDialogOptions) chan []string {
|
|
// TODO: Implement using Android file picker intent
|
|
ch := make(chan []string, 1)
|
|
ch <- []string{}
|
|
return ch
|
|
}
|
|
|
|
func (d *dialogsImpl) openDirectory(id uint, param OpenFileDialogOptions) chan string {
|
|
// TODO: Implement using Android file picker intent
|
|
ch := make(chan string, 1)
|
|
ch <- ""
|
|
return ch
|
|
}
|
|
|
|
func (d *dialogsImpl) saveFile(id uint, param SaveFileDialogOptions) chan string {
|
|
// TODO: Implement using Android file picker intent
|
|
ch := make(chan string, 1)
|
|
ch <- ""
|
|
return ch
|
|
}
|
|
|
|
type androidDialog struct {
|
|
dialog *MessageDialog
|
|
}
|
|
|
|
func (d *androidDialog) show() {
|
|
// TODO: Implement using AlertDialog
|
|
}
|
|
|
|
func newDialogImpl(d *MessageDialog) *androidDialog {
|
|
return &androidDialog{
|
|
dialog: d,
|
|
}
|
|
}
|
|
|
|
func (d *dialogsImpl) show() (chan string, error) {
|
|
ch := make(chan string, 1)
|
|
ch <- ""
|
|
return ch, nil
|
|
}
|
|
|
|
func newOpenFileDialogImpl(_ *OpenFileDialogStruct) openFileDialogImpl {
|
|
return &dialogsImpl{}
|
|
}
|
|
|
|
func newSaveFileDialogImpl(_ *SaveFileDialogStruct) saveFileDialogImpl {
|
|
return &dialogsImpl{}
|
|
}
|