diff --git a/.changelog/lang_zh-Hans.json b/.changelog/lang_zh-Hans.json index 8814d411..5c8a70d7 100644 --- a/.changelog/lang_zh-Hans.json +++ b/.changelog/lang_zh-Hans.json @@ -2,6 +2,9 @@ "$data": { "v6.6.2": { "released_date": "2025/01/03", + "fix": [ + "notice 模块缺失 getBuilder 等扩展方法的问题 _[`issue #301`](http://issues.autojs6.com/301)_" + ], "improvement": [ "精简打包应用模板 APK 文件大小", "打包页面支持 Pinyin 库选项", diff --git a/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Channel.kt b/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Channel.kt index f2131378..9457f4d6 100644 --- a/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Channel.kt +++ b/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Channel.kt @@ -1,5 +1,6 @@ package org.autojs.autojs.runtime.api.augment.notice +import android.annotation.SuppressLint import android.app.Notification import android.app.NotificationChannel import android.app.NotificationManager @@ -137,6 +138,7 @@ class Channel(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) { } } + @SuppressLint("NewApi") if (scriptRuntime.notice.config.enableChannelInvalidModificationWarnings && contains(scriptRuntime, arrayOf(id)) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O @@ -180,7 +182,7 @@ class Channel(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) { else -> AugmentableNotice.parseChannelId(scriptRuntime, arg0) } if (!contains(scriptRuntime, arrayOf(channelId))) { - val options = if (arg0 is NativeObject) arg0 else arg1 + val options = arg0 as? NativeObject ?: arg1 create(scriptRuntime, arrayOf(channelId, options)) } UNDEFINED diff --git a/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Notice.kt b/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Notice.kt index 485116ca..89a03e89 100644 --- a/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Notice.kt +++ b/app/src/main/java/org/autojs/autojs/runtime/api/augment/notice/Notice.kt @@ -28,6 +28,7 @@ import org.autojs.autojs.util.RhinoUtils.undefined import org.mozilla.javascript.Context import org.mozilla.javascript.NativeObject import org.mozilla.javascript.Undefined +import java.util.function.Supplier import kotlin.math.roundToInt import kotlin.reflect.KMutableProperty1 @@ -43,6 +44,19 @@ import kotlin.reflect.KMutableProperty1 @Suppress("unused", "UNUSED_PARAMETER") class Notice(private val scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), Invokable { + override val selfAssignmentFunctions = listOf( + ::isEnabled.name, + ::ensureEnabled.name, + ::launchSettings.name, + ::config.name, + ::cancel.name, + ::getBuilder.name, + ) + + override val selfAssignmentGetters = listOf>>( + "builder" to Supplier { getBuilder(scriptRuntime, emptyArray()) } + ) + @Suppress("UnnecessaryVariable") override fun invoke(vararg args: Any?): Int = ensureArgumentsAtMost(args, 3) { argList -> val (arg0, arg1, arg2) = argList diff --git a/version.properties b/version.properties index e32857b7..23afb7c7 100644 --- a/version.properties +++ b/version.properties @@ -1,5 +1,5 @@ -#Sat Jan 11 16:27:44 CST 2025 -BUILD_TIME=1736584064033 +#Sat Jan 11 19:18:51 CST 2025 +BUILD_TIME=1736594331756 COMPILE_SDK_VERSION=34 JAVA_VERSION=23 JAVA_VERSION_MIN_RADICAL=0 @@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3 TARGET_SDK_VERSION=34 TARGET_SDK_VERSION_INRT=29 -VERSION_BUILD=2959 +VERSION_BUILD=2960 VERSION_NAME=6.6.2 Alpha VSCODE_EXT_REQUIRED_VERSION=1.0.8