6.6.3 - Alpha5 - 修复 dialogs.input 方法的表达式参数可能无法获得执行结果的问题

This commit is contained in:
SuperMonster003
2025-05-25 20:36:47 +08:00
parent 3168f2d4bb
commit e9afc6ccbb
8 changed files with 40 additions and 18 deletions

View File

@@ -545,7 +545,7 @@ public class UpdateChecker {
}
private String assembleDependenciesInReleaseNotesListMarkdown(String fullReleaseNotes) {
// TODO by SuperMonster003 on Apr 24. 2025.
// TODO by SuperMonster003 on Apr 24, 2025.
// ! Remove all dependency items and append a summary item as improvement.
// ! Reference to `generate_markdown.py`.
return fullReleaseNotes;

View File

@@ -248,7 +248,7 @@ public class Shell extends AbstractShell {
}
private void onOutput(String str) {
if (!str.isEmpty()) {
if (!str.isEmpty() && !str.contains("/dev/input/event")) {
logDebug("onOutput: " + str);
}
if (!mInitialized) {

View File

@@ -204,7 +204,8 @@ class Dialogs(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
callback.isJsNullish() -> {
val title = coerceString(titleArg, "")
val prefill = coerceString(prefillArg, "")
scriptRuntime.dialogs.rawInput(title, prefill, null)
val result = scriptRuntime.dialogs.rawInput(title, prefill, null)
js_eval(scriptRuntime.topLevelScope, Context.toString(result))
}
else -> {
val title = coerceString(titleArg, "")
@@ -212,7 +213,12 @@ class Dialogs(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
require(callback is BaseFunction) {
"Argument callback ${callback.jsBrief()} must be a JavaScript Function for dialogs.input"
}
scriptRuntime.dialogs.rawInput(title, prefill, callback)
val newCallback = newBaseFunction("newCallback", { newCallbackArgs ->
val (str) = newCallbackArgs
val newStr = js_eval(scriptRuntime.topLevelScope, Context.toString(str))
callFunction(callback, scriptRuntime.topLevelScope, null, arrayOf(newStr))
}, NOT_CONSTRUCTABLE)
scriptRuntime.dialogs.rawInput(title, prefill, newCallback)
}
}
}

View File

@@ -80,6 +80,9 @@ class Classes {
@JvmField
val Log = android.util.Log::class
@JvmField
val TypedValue = android.util.TypedValue::class
@JvmField
val ContextThemeWrapper = android.view.ContextThemeWrapper::class
@@ -92,6 +95,12 @@ class Classes {
@JvmField
val MotionEvent = android.view.MotionEvent::class
@JvmField
val ScaleGestureDetector = android.view.ScaleGestureDetector::class
@JvmField
val WindowManager = android.view.WindowManager::class
@JvmField
val LayoutParams = android.view.WindowManager.LayoutParams::class
@@ -125,6 +134,9 @@ class Classes {
@JvmField
val Snackbar = com.google.android.material.snackbar.Snackbar::class
@JvmField
val MaterialDialog = com.afollestad.materialdialogs.MaterialDialog::class
@JvmField
val LogConfigurator = de.mindpipe.android.logging.log4j.LogConfigurator::class
@@ -302,6 +314,9 @@ class Classes {
@JvmField
val DisplayUtils = org.autojs.autojs.util.DisplayUtils::class
@JvmField
val IntentUtils = org.autojs.autojs.util.IntentUtils::class
@JvmField
val JavaUtils = org.autojs.autojs.util.JavaUtils::class

View File

@@ -258,7 +258,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
}
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
@JvmStatic
@RhinoRuntimeFunctionInterface
fun requestScreenCapture(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsAtMost(args, 2) { argList ->
@@ -280,7 +280,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
}
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
@JvmStatic
@RhinoRuntimeFunctionInterface
fun requestScreenCaptureAsync(scriptRuntime: ScriptRuntime, args: Array<out Any?>): NativeObject = ensureArgumentsAtMost(args, 2) { argList ->
@@ -290,14 +290,14 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
})) as NativeObject
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
@JvmStatic
@RhinoRuntimeFunctionInterface
fun stopScreenCapture(scriptRuntime: ScriptRuntime, args: Array<out Any?>) = ensureArgumentsIsEmpty(args) {
scriptRuntime.images.stopScreenCapture()
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
@JvmStatic
@RhinoRuntimeFunctionInterface
fun getScreenCaptureOptions(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ScreenCapturer.Options? = ensureArgumentsIsEmpty(args) {
@@ -697,7 +697,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
detectColor(scriptRuntime, it)
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on May 10. 2025.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on May 10, 2025.
@JvmStatic
@RhinoRuntimeFunctionInterface
fun detectMultiColors(scriptRuntime: ScriptRuntime, args: Array<out Any?>): Boolean = ensureArgumentsLengthInRange(args, 5..6) {
@@ -1007,7 +1007,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
}
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
@JvmStatic
@RhinoRuntimeFunctionInterface
fun detectAndComputeFeatures(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ImageFeatures = ensureArgumentsLengthInRange(args, 1..2) {
@@ -1022,7 +1022,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
ImageFeatures(result, opt.scale, rect)
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
@JvmStatic
@RhinoRuntimeFunctionInterface
fun matchFeatures(scriptRuntime: ScriptRuntime, args: Array<out Any?>): ObjectFrame? = ensureArgumentsLengthInRange(args, 2..3) { argList ->
@@ -1508,7 +1508,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
}
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
private fun getDetectFeatureMethod(method: Any?): Int = when (method) {
is Number -> method.toInt()
is String -> {
@@ -1521,7 +1521,7 @@ class Images(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), AsEmitt
else -> throw Error("Non-recognized method: $method")
}
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
private fun fillDetectAndComputeFeaturesOptions(rows: Int, cols: Int, options: NativeObject): DetectAndComputeFeaturesOptions {
val scale = options.inquire("scale") { coerceFloatNumber(it) } ?: calcScale(rows, cols)
val cvtColor = when {

View File

@@ -3,7 +3,7 @@ package org.autojs.autojs.runtime.api.augment.images
import org.autojs.autojs.util.StringUtils
import org.opencv.core.Point
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19. 2023.
// @Reference to module __images__.js from Auto.js Pro 9.3.11 by SuperMonster003 on Dec 19, 2023.
/**
* Created by SuperMonster003 on Aug 9, 2024.
*/