mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-05 04:59:05 +08:00
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:requestLegacyExternalStorage="true">
|
||||
|
||||
<!-- 暂时不开启接收开机广播的功能 enabled设置为false-->
|
||||
<receiver
|
||||
android:name=".BootReceiver"
|
||||
android:enabled="false"
|
||||
|
@ -31,22 +31,23 @@ class MainActivity : FlutterActivity() {
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun configureFlutterEngine(flutterEngine: 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()
|
||||
flutterMethodChannel = MethodChannel(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
channelTag
|
||||
).apply {
|
||||
// make sure result is set, otherwise flutter will await forever
|
||||
setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"init_service" -> {
|
||||
Log.d(logTag, "event from flutter,getPer")
|
||||
if(mainService?.isReady == false){
|
||||
getMediaProjection()
|
||||
Intent(activity, MainService::class.java).also {
|
||||
bindService(it, serviceConnection, Context.BIND_AUTO_CREATE)
|
||||
}
|
||||
if(mainService?.isReady == true){
|
||||
result.success(false)
|
||||
return@setMethodCallHandler
|
||||
}
|
||||
getMediaProjection()
|
||||
result.success(true)
|
||||
}
|
||||
"start_capture" -> {
|
||||
@ -68,11 +69,15 @@ class MainActivity : FlutterActivity() {
|
||||
"check_permission" -> {
|
||||
if(call.arguments is String){
|
||||
result.success(checkPermission(context, call.arguments as String))
|
||||
} else {
|
||||
result.success(false)
|
||||
}
|
||||
}
|
||||
"request_permission" -> {
|
||||
if(call.arguments is String){
|
||||
requestPermission(context, call.arguments as String)
|
||||
} else {
|
||||
result.success(false)
|
||||
}
|
||||
}
|
||||
"check_video_permission" -> {
|
||||
@ -91,6 +96,7 @@ class MainActivity : FlutterActivity() {
|
||||
"on_state_changed",
|
||||
mapOf("name" to "media", "value" to mainService?.isReady.toString())
|
||||
)
|
||||
result.success(true)
|
||||
}
|
||||
"init_input" -> {
|
||||
initInput()
|
||||
@ -105,15 +111,20 @@ class MainActivity : FlutterActivity() {
|
||||
"on_state_changed",
|
||||
mapOf("name" to "input", "value" to InputService.isOpen.toString())
|
||||
)
|
||||
result.success(true)
|
||||
}
|
||||
"cancel_notification" -> {
|
||||
try {
|
||||
val id = call.arguments as Int
|
||||
Log.d(logTag,"cancel_notification id:$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.view.Surface
|
||||
import android.view.Surface.FRAME_RATE_COMPATIBILITY_DEFAULT
|
||||
import androidx.annotation.Keep
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.app.NotificationCompat
|
||||
@ -65,6 +66,7 @@ class MainService : Service() {
|
||||
}
|
||||
|
||||
// rust call jvm
|
||||
@Keep
|
||||
fun rustGetVideoRaw(): ByteArray {
|
||||
return if (videoData != null) {
|
||||
videoData!!
|
||||
@ -73,6 +75,7 @@ class MainService : Service() {
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
fun rustGetAudioRaw(): FloatArray {
|
||||
return if (isNewData && audioData != null) {
|
||||
isNewData = false
|
||||
@ -82,12 +85,14 @@ class MainService : Service() {
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
fun rustGetAudioRawLen(): Int {
|
||||
return if (isNewData && audioData != null && audioData!!.isNotEmpty()) {
|
||||
audioData!!.size
|
||||
} else 0
|
||||
}
|
||||
|
||||
@Keep
|
||||
fun rustGetByName(name: String): String {
|
||||
return when (name) {
|
||||
"screen_size" -> "${INFO.screenWidth}:${INFO.screenHeight}"
|
||||
@ -95,6 +100,7 @@ class MainService : Service() {
|
||||
}
|
||||
}
|
||||
|
||||
@Keep
|
||||
fun rustSetByName(name: String, arg1: String, arg2: String) {
|
||||
when (name) {
|
||||
"try_start_without_auth" -> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
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 *
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user