Update Android icons and enter action

This commit is contained in:
Misaka
2026-05-16 22:00:02 +08:00
parent fe5cb9af37
commit 7cd6fbd1f2
11 changed files with 33 additions and 7 deletions

View File

@@ -123,6 +123,11 @@ class NativeConnectionApi {
return result ?? false;
}
Future<bool> sendEnter() async {
final result = await _methodChannel.invokeMethod<bool>('sendEnter');
return result ?? false;
}
Future<List<DiscoveredDevice>> startDiscovery() async {
try {
final result = await _methodChannel.invokeListMethod<dynamic>(
@@ -341,15 +346,14 @@ class _InputSyncPageState extends State<InputSyncPage>
}
final draft = inputController.text;
final textToSend = appendEnter ? '$draft\n' : draft;
setState(() {
sendButtonState = SendButtonState.sending;
});
try {
final sent = await api.sendText(textToSend);
if (!sent) {
final sent = await api.sendText(draft);
final enterSent = !sent || !appendEnter ? true : await api.sendEnter();
if (!sent || !enterSent) {
_showToast('发送失败,连接已断开');
setState(() {
sendButtonState = SendButtonState.idle;