mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
fix(android): update gradlew command for Windows compatibility and improve message processing
This commit is contained in:
parent
1c804603e9
commit
c5d992ca47
7 changed files with 33 additions and 32 deletions
|
|
@ -128,7 +128,7 @@ tasks:
|
|||
|
||||
# ./gradlew doesn't work on windows
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew" ;;
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew.bat" ;;
|
||||
*) gradlew="./gradlew" ;;
|
||||
esac
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ tasks:
|
|||
|
||||
# ./gradlew doesn't work on windows
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew" ;;
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew.bat" ;;
|
||||
*) gradlew="./gradlew" ;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
|
|
@ -45,21 +46,21 @@ public class WailsBridge {
|
|||
private WebView webView;
|
||||
private volatile boolean initialized = false;
|
||||
private BottomNavigationView nativeTabsView;
|
||||
private List<String> nativeTabTitles = new ArrayList<>();
|
||||
private boolean nativeTabsEnabled = false;
|
||||
private boolean scrollEnabled = true;
|
||||
private boolean bounceEnabled = true;
|
||||
private boolean scrollIndicatorsEnabled = true;
|
||||
private boolean backForwardGesturesEnabled = false;
|
||||
private boolean linkPreviewEnabled = true;
|
||||
private String customUserAgent = null;
|
||||
private float touchStartX = 0f;
|
||||
private float touchStartY = 0f;
|
||||
private int swipeThresholdPx = 120;
|
||||
private View.OnTouchListener touchListener;
|
||||
private final CopyOnWriteArrayList<String> nativeTabTitles = new CopyOnWriteArrayList<>();
|
||||
private volatile boolean nativeTabsEnabled = false;
|
||||
private volatile boolean scrollEnabled = true;
|
||||
private volatile boolean bounceEnabled = true;
|
||||
private volatile boolean scrollIndicatorsEnabled = true;
|
||||
private volatile boolean backForwardGesturesEnabled = false;
|
||||
private volatile boolean linkPreviewEnabled = true;
|
||||
private volatile String customUserAgent = null;
|
||||
private volatile float touchStartX = 0f;
|
||||
private volatile float touchStartY = 0f;
|
||||
private volatile int swipeThresholdPx = 120;
|
||||
private volatile View.OnTouchListener touchListener;
|
||||
private final View.OnLongClickListener blockLongClickListener = v -> true;
|
||||
|
||||
private static final List<String> DEFAULT_NATIVE_TAB_TITLES = Collections.emptyList();
|
||||
private static final List<String> DEFAULT_NATIVE_TAB_TITLES = Collections.singletonList("Home");
|
||||
|
||||
// Native methods - implemented in Go
|
||||
private static native void nativeInit(WailsBridge bridge);
|
||||
|
|
@ -371,7 +372,8 @@ public class WailsBridge {
|
|||
}
|
||||
}
|
||||
|
||||
nativeTabTitles = titles;
|
||||
nativeTabTitles.clear();
|
||||
nativeTabTitles.addAll(titles);
|
||||
if (!nativeTabTitles.isEmpty()) {
|
||||
nativeTabsEnabled = true;
|
||||
}
|
||||
|
|
@ -425,15 +427,14 @@ public class WailsBridge {
|
|||
return;
|
||||
}
|
||||
|
||||
boolean shouldShow = nativeTabsEnabled || (nativeTabTitles != null && !nativeTabTitles.isEmpty());
|
||||
if (!shouldShow) {
|
||||
tabs.setVisibility(View.GONE);
|
||||
return;
|
||||
List<String> titles = nativeTabTitles;
|
||||
if (titles.isEmpty()) {
|
||||
titles = DEFAULT_NATIVE_TAB_TITLES;
|
||||
}
|
||||
|
||||
List<String> titles = nativeTabTitles;
|
||||
if (titles == null || titles.isEmpty()) {
|
||||
titles = DEFAULT_NATIVE_TAB_TITLES;
|
||||
if (!nativeTabsEnabled) {
|
||||
tabs.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
Menu menu = tabs.getMenu();
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ tasks:
|
|||
|
||||
# ./gradlew doesn't work on windows
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew" ;;
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew.bat" ;;
|
||||
*) gradlew="./gradlew" ;;
|
||||
esac
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ tasks:
|
|||
|
||||
# ./gradlew doesn't work on windows
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew" ;;
|
||||
MINGW*|MSYS*|CYGWIN*) gradlew="powershell ./gradlew.bat" ;;
|
||||
*) gradlew="./gradlew" ;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class WailsBridge {
|
|||
private volatile View.OnTouchListener touchListener;
|
||||
private final View.OnLongClickListener blockLongClickListener = v -> true;
|
||||
|
||||
private static final List<String> DEFAULT_NATIVE_TAB_TITLES = Collections.emptyList();
|
||||
private static final List<String> DEFAULT_NATIVE_TAB_TITLES = Collections.singletonList("Home");
|
||||
|
||||
// Native methods - implemented in Go
|
||||
private static native void nativeInit(WailsBridge bridge);
|
||||
|
|
@ -432,8 +432,7 @@ public class WailsBridge {
|
|||
titles = DEFAULT_NATIVE_TAB_TITLES;
|
||||
}
|
||||
|
||||
boolean shouldShow = nativeTabsEnabled && !titles.isEmpty();
|
||||
if (!shouldShow) {
|
||||
if (!nativeTabsEnabled) {
|
||||
tabs.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func New(appOptions Options) *App {
|
|||
|
||||
result.customEventProcessor = NewWailsEventProcessor(result.Event.dispatch)
|
||||
|
||||
messageProc := NewMessageProcessor(result.Logger)
|
||||
result.messageProcessor = NewMessageProcessor(result.Logger)
|
||||
|
||||
// Initialize transport (default to HTTP if not specified)
|
||||
transport := appOptions.Transport
|
||||
|
|
@ -74,7 +74,7 @@ func New(appOptions Options) *App {
|
|||
transport = NewHTTPTransport(HTTPTransportWithLogger(result.Logger))
|
||||
}
|
||||
|
||||
err := transport.Start(result.ctx, messageProc)
|
||||
err := transport.Start(result.ctx, result.messageProcessor)
|
||||
if err != nil {
|
||||
result.fatal("failed to start custom transport: %w", err)
|
||||
}
|
||||
|
|
@ -377,6 +377,7 @@ type App struct {
|
|||
|
||||
clipboard *Clipboard
|
||||
customEventProcessor *EventProcessor
|
||||
messageProcessor *MessageProcessor
|
||||
Logger *slog.Logger
|
||||
|
||||
contextMenus map[string]*ContextMenu
|
||||
|
|
|
|||
|
|
@ -867,7 +867,7 @@ func handleMessageForAndroid(app *App, message string) string {
|
|||
return marshalAndroidInvokeResponse(nil, fmt.Errorf("unsupported message type: %s", payload.Type))
|
||||
}
|
||||
|
||||
processor := NewMessageProcessor(app.Logger)
|
||||
processor := app.messageProcessor
|
||||
request := &RuntimeRequest{
|
||||
Object: payload.Object,
|
||||
Method: payload.Method,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build android && !server
|
||||
//go:build android
|
||||
|
||||
package application
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue