Fix keyboard plug in, streaming don't close

This commit is contained in:
Caten
2023-10-09 06:47:57 +08:00
parent b6d4d2f11b
commit 2cf19179f9
4 changed files with 9 additions and 8 deletions

View File

@@ -23,6 +23,7 @@ assets的文件来源如下:
- [proot](https://github.com/Cateners/proot), 使用[build-proot-android](https://github.com/green-green-avk/build-proot-android)脚本编译 - [proot](https://github.com/Cateners/proot), 使用[build-proot-android](https://github.com/green-green-avk/build-proot-android)脚本编译
- [busybox](https://github.com/meefik/busybox) - [busybox](https://github.com/meefik/busybox)
- [mediamtx相关](https://github.com/bluenviron/mediamtx)
- [tar](https://github.com/Rprop/tar-android-static) - [tar](https://github.com/Rprop/tar-android-static)
- [Xserver XSDL, pulseaudio相关文件](https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/application/xserver) - [Xserver XSDL, pulseaudio相关文件](https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/application/xserver)
- [Tmoe Linux, debian包来源](https://github.com/2moe/tmoe) - [Tmoe Linux, debian包来源](https://github.com/2moe/tmoe)

View File

@@ -15,7 +15,7 @@
android:exported="true" android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="navigation|orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as

View File

@@ -25,6 +25,7 @@ import 'dart:math';
import 'package:clipboard/clipboard.dart'; import 'package:clipboard/clipboard.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:flutter_pty/flutter_pty.dart'; import 'package:flutter_pty/flutter_pty.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
//import 'package:flutter/services.dart'; //import 'package:flutter/services.dart';
@@ -677,6 +678,7 @@ SOFTWARE.
启用小键盘: 观看3个广告 启用小键盘: 观看3个广告
关闭横幅广告: 观看5个广告 关闭横幅广告: 观看5个广告
终端最大行数修改: 观看6个广告 终端最大行数修改: 观看6个广告
推流参数修改: 观看8个广告
我设置了每天最多可以看5个广告。 我设置了每天最多可以看5个广告。
只要看满1个广告, 就可以在本次使用期间临时解锁全部功能。 只要看满1个广告, 就可以在本次使用期间临时解锁全部功能。
@@ -1179,7 +1181,7 @@ class _MyHomePageState extends State<MyHomePage> {
switch (value) { switch (value) {
case true: { case true: {
G.streamServerPty = Pty.start("/system/bin/sh"); G.streamServerPty = Pty.start("/system/bin/sh");
G.streamServerPty.write(const Utf8Encoder().convert("${G.dataPath}/bin/mediamtx ${G.dataPath}/bin/mediamtx.yml &\n")); G.streamServerPty.write(const Utf8Encoder().convert("${G.dataPath}/bin/mediamtx ${G.dataPath}/bin/mediamtx.yml & pid=\$(echo \$!)\n"));
G.streamServerPty.exitCode.then((value) { G.streamServerPty.exitCode.then((value) {
G.isStreamServerStarted = false; G.isStreamServerStarted = false;
setState(() {}); setState(() {});
@@ -1187,12 +1189,7 @@ class _MyHomePageState extends State<MyHomePage> {
} }
break; break;
case false: { case false: {
G.streamServerPty.write(const Utf8Encoder().convert(""" G.streamServerPty.write(const Utf8Encoder().convert("kill \$pid\nexit\n"));
pids=${G.dataPath}/busybox pgrep '${G.dataPath}/bin/mediamtx';
for pid in \$pids; do
kill \$pid
done
exit\n"""));
} }
break; break;
} }

View File

@@ -587,6 +587,9 @@ done
G.controller = WebViewController()..setJavaScriptMode(JavaScriptMode.unrestricted); G.controller = WebViewController()..setJavaScriptMode(JavaScriptMode.unrestricted);
//恢复临时开启的功能 //恢复临时开启的功能
if (Util.shouldWatchAds(G.adsRequired["changeFFmpegCommand"]!)) {
await G.prefs.remove("defaultFFmpegCommand");
}
if (Util.shouldWatchAds(G.adsRequired["changeTermMaxLines"]!)) { if (Util.shouldWatchAds(G.adsRequired["changeTermMaxLines"]!)) {
await G.prefs.setInt("termMaxLines", 4095); await G.prefs.setInt("termMaxLines", 4095);
} }