Merge branch 'master' of github.com-flutter_hbb:open-trade/flutter_hbb
This commit is contained in:
commit
42eed4fcd0
@ -16,7 +16,6 @@
|
|||||||
android:label="RustDesk"
|
android:label="RustDesk"
|
||||||
android:requestLegacyExternalStorage="true">
|
android:requestLegacyExternalStorage="true">
|
||||||
|
|
||||||
<!-- 暂时不开启接收开机广播的功能 enabled设置为false-->
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".BootReceiver"
|
android:name=".BootReceiver"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
|
|||||||
@ -31,22 +31,23 @@ class MainActivity : FlutterActivity() {
|
|||||||
@RequiresApi(Build.VERSION_CODES.M)
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
||||||
super.configureFlutterEngine(flutterEngine)
|
super.configureFlutterEngine(flutterEngine)
|
||||||
Log.d(logTag, "MainActivity configureFlutterEngine,bind to main service")
|
|
||||||
Intent(this, MainService::class.java).also {
|
|
||||||
bindService(it, serviceConnection, Context.BIND_AUTO_CREATE)
|
|
||||||
}
|
|
||||||
updateMachineInfo()
|
updateMachineInfo()
|
||||||
flutterMethodChannel = MethodChannel(
|
flutterMethodChannel = MethodChannel(
|
||||||
flutterEngine.dartExecutor.binaryMessenger,
|
flutterEngine.dartExecutor.binaryMessenger,
|
||||||
channelTag
|
channelTag
|
||||||
).apply {
|
).apply {
|
||||||
|
// make sure result is set, otherwise flutter will await forever
|
||||||
setMethodCallHandler { call, result ->
|
setMethodCallHandler { call, result ->
|
||||||
when (call.method) {
|
when (call.method) {
|
||||||
"init_service" -> {
|
"init_service" -> {
|
||||||
Log.d(logTag, "event from flutter,getPer")
|
Intent(activity, MainService::class.java).also {
|
||||||
if(mainService?.isReady == false){
|
bindService(it, serviceConnection, Context.BIND_AUTO_CREATE)
|
||||||
getMediaProjection()
|
|
||||||
}
|
}
|
||||||
|
if(mainService?.isReady == true){
|
||||||
|
result.success(false)
|
||||||
|
return@setMethodCallHandler
|
||||||
|
}
|
||||||
|
getMediaProjection()
|
||||||
result.success(true)
|
result.success(true)
|
||||||
}
|
}
|
||||||
"start_capture" -> {
|
"start_capture" -> {
|
||||||
@ -68,11 +69,15 @@ class MainActivity : FlutterActivity() {
|
|||||||
"check_permission" -> {
|
"check_permission" -> {
|
||||||
if(call.arguments is String){
|
if(call.arguments is String){
|
||||||
result.success(checkPermission(context, call.arguments as String))
|
result.success(checkPermission(context, call.arguments as String))
|
||||||
|
} else {
|
||||||
|
result.success(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"request_permission" -> {
|
"request_permission" -> {
|
||||||
if(call.arguments is String){
|
if(call.arguments is String){
|
||||||
requestPermission(context, call.arguments as String)
|
requestPermission(context, call.arguments as String)
|
||||||
|
} else {
|
||||||
|
result.success(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"check_video_permission" -> {
|
"check_video_permission" -> {
|
||||||
@ -91,6 +96,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
"on_state_changed",
|
"on_state_changed",
|
||||||
mapOf("name" to "media", "value" to mainService?.isReady.toString())
|
mapOf("name" to "media", "value" to mainService?.isReady.toString())
|
||||||
)
|
)
|
||||||
|
result.success(true)
|
||||||
}
|
}
|
||||||
"init_input" -> {
|
"init_input" -> {
|
||||||
initInput()
|
initInput()
|
||||||
@ -105,15 +111,20 @@ class MainActivity : FlutterActivity() {
|
|||||||
"on_state_changed",
|
"on_state_changed",
|
||||||
mapOf("name" to "input", "value" to InputService.isOpen.toString())
|
mapOf("name" to "input", "value" to InputService.isOpen.toString())
|
||||||
)
|
)
|
||||||
|
result.success(true)
|
||||||
}
|
}
|
||||||
"cancel_notification" -> {
|
"cancel_notification" -> {
|
||||||
try {
|
try {
|
||||||
val id = call.arguments as Int
|
val id = call.arguments as Int
|
||||||
Log.d(logTag,"cancel_notification id:$id")
|
Log.d(logTag,"cancel_notification id:$id")
|
||||||
mainService?.cancelNotification(id)
|
mainService?.cancelNotification(id)
|
||||||
}finally { }
|
}finally {
|
||||||
|
result.success(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
result.error("-1","No such method",null)
|
||||||
}
|
}
|
||||||
else -> {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import android.os.*
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.Surface
|
import android.view.Surface
|
||||||
import android.view.Surface.FRAME_RATE_COMPATIBILITY_DEFAULT
|
import android.view.Surface.FRAME_RATE_COMPATIBILITY_DEFAULT
|
||||||
|
import androidx.annotation.Keep
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
@ -65,6 +66,7 @@ class MainService : Service() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rust call jvm
|
// rust call jvm
|
||||||
|
@Keep
|
||||||
fun rustGetVideoRaw(): ByteArray {
|
fun rustGetVideoRaw(): ByteArray {
|
||||||
return if (videoData != null) {
|
return if (videoData != null) {
|
||||||
videoData!!
|
videoData!!
|
||||||
@ -73,6 +75,7 @@ class MainService : Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
fun rustGetAudioRaw(): FloatArray {
|
fun rustGetAudioRaw(): FloatArray {
|
||||||
return if (isNewData && audioData != null) {
|
return if (isNewData && audioData != null) {
|
||||||
isNewData = false
|
isNewData = false
|
||||||
@ -82,12 +85,14 @@ class MainService : Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
fun rustGetAudioRawLen(): Int {
|
fun rustGetAudioRawLen(): Int {
|
||||||
return if (isNewData && audioData != null && audioData!!.isNotEmpty()) {
|
return if (isNewData && audioData != null && audioData!!.isNotEmpty()) {
|
||||||
audioData!!.size
|
audioData!!.size
|
||||||
} else 0
|
} else 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
fun rustGetByName(name: String): String {
|
fun rustGetByName(name: String): String {
|
||||||
return when (name) {
|
return when (name) {
|
||||||
"screen_size" -> "${INFO.screenWidth}:${INFO.screenHeight}"
|
"screen_size" -> "${INFO.screenWidth}:${INFO.screenHeight}"
|
||||||
@ -95,6 +100,7 @@ class MainService : Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
fun rustSetByName(name: String, arg1: String, arg2: String) {
|
fun rustSetByName(name: String, arg1: String, arg2: String) {
|
||||||
when (name) {
|
when (name) {
|
||||||
"try_start_without_auth" -> {
|
"try_start_without_auth" -> {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
cd build/web/
|
cd build/web/
|
||||||
python3 -c 'x=open("./main.dart.js").read();import re;y=re.search("https://.*canvaskit-wasm@([\d\.]+)/bin/",x);dirname="canvaskit@"+y.groups()[0];z=x.replace(y.group(),"/"+dirname+"/");f=open("./main.dart.js", "wt");f.write(z);import os;os.system("ln -s canvaskit " + dirname);'
|
python3 -c 'x=open("./main.dart.js", "rt").read();import re;y=re.search("https://.*canvaskit-wasm@([\d\.]+)/bin/",x);dirname="canvaskit@"+y.groups()[0];z=x.replace(y.group(),"/"+dirname+"/");f=open("./main.dart.js", "wt");f.write(z);import os;os.system("ln -s canvaskit " + dirname);'
|
||||||
|
python3 -c 'import hashlib;x=hashlib.sha1(open("./main.dart.js").read().encode()).hexdigest()[:10];y=open("index.html","rt").read().replace("main.dart.js", "main.dart.js?v="+x);open("index.html","wt").write(y)'
|
||||||
tar czf x *
|
tar czf x *
|
||||||
scp x sg:/tmp/
|
scp x sg:/tmp/
|
||||||
ssh sg "sudo tar xzf /tmp/x -C /var/www/html/web.rustdesk.com/ && /bin/rm /tmp/x && sudo chown www-data:www-data /var/www/html/web.rustdesk.com/ -R"
|
ssh sg "sudo tar xzf /tmp/x -C /var/www/html/web.rustdesk.com/ && /bin/rm /tmp/x && sudo chown www-data:www-data /var/www/html/web.rustdesk.com/ -R"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user