6.6.2 - Alpha - 修复 notice 模块缺失 getBuilder 等扩展方法的问题 (issue #301)

This commit is contained in:
SuperMonster003
2025-01-11 20:38:23 +08:00
parent 9f9aea7a05
commit 5da132ab0b
4 changed files with 23 additions and 4 deletions

View File

@@ -2,6 +2,9 @@
"$data": { "$data": {
"v6.6.2": { "v6.6.2": {
"released_date": "2025/01/03", "released_date": "2025/01/03",
"fix": [
"notice 模块缺失 getBuilder 等扩展方法的问题 _[`issue #301`](http://issues.autojs6.com/301)_"
],
"improvement": [ "improvement": [
"精简打包应用模板 APK 文件大小", "精简打包应用模板 APK 文件大小",
"打包页面支持 Pinyin 库选项", "打包页面支持 Pinyin 库选项",

View File

@@ -1,5 +1,6 @@
package org.autojs.autojs.runtime.api.augment.notice package org.autojs.autojs.runtime.api.augment.notice
import android.annotation.SuppressLint
import android.app.Notification import android.app.Notification
import android.app.NotificationChannel import android.app.NotificationChannel
import android.app.NotificationManager import android.app.NotificationManager
@@ -137,6 +138,7 @@ class Channel(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
} }
} }
@SuppressLint("NewApi")
if (scriptRuntime.notice.config.enableChannelInvalidModificationWarnings if (scriptRuntime.notice.config.enableChannelInvalidModificationWarnings
&& contains(scriptRuntime, arrayOf(id)) && contains(scriptRuntime, arrayOf(id))
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
@@ -180,7 +182,7 @@ class Channel(scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime) {
else -> AugmentableNotice.parseChannelId(scriptRuntime, arg0) else -> AugmentableNotice.parseChannelId(scriptRuntime, arg0)
} }
if (!contains(scriptRuntime, arrayOf(channelId))) { 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)) create(scriptRuntime, arrayOf(channelId, options))
} }
UNDEFINED UNDEFINED

View File

@@ -28,6 +28,7 @@ import org.autojs.autojs.util.RhinoUtils.undefined
import org.mozilla.javascript.Context import org.mozilla.javascript.Context
import org.mozilla.javascript.NativeObject import org.mozilla.javascript.NativeObject
import org.mozilla.javascript.Undefined import org.mozilla.javascript.Undefined
import java.util.function.Supplier
import kotlin.math.roundToInt import kotlin.math.roundToInt
import kotlin.reflect.KMutableProperty1 import kotlin.reflect.KMutableProperty1
@@ -43,6 +44,19 @@ import kotlin.reflect.KMutableProperty1
@Suppress("unused", "UNUSED_PARAMETER") @Suppress("unused", "UNUSED_PARAMETER")
class Notice(private val scriptRuntime: ScriptRuntime) : Augmentable(scriptRuntime), Invokable { 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<Pair<String, Supplier<Any?>>>(
"builder" to Supplier { getBuilder(scriptRuntime, emptyArray()) }
)
@Suppress("UnnecessaryVariable") @Suppress("UnnecessaryVariable")
override fun invoke(vararg args: Any?): Int = ensureArgumentsAtMost(args, 3) { argList -> override fun invoke(vararg args: Any?): Int = ensureArgumentsAtMost(args, 3) { argList ->
val (arg0, arg1, arg2) = argList val (arg0, arg1, arg2) = argList

View File

@@ -1,5 +1,5 @@
#Sat Jan 11 16:27:44 CST 2025 #Sat Jan 11 19:18:51 CST 2025
BUILD_TIME=1736584064033 BUILD_TIME=1736594331756
COMPILE_SDK_VERSION=34 COMPILE_SDK_VERSION=34
JAVA_VERSION=23 JAVA_VERSION=23
JAVA_VERSION_MIN_RADICAL=0 JAVA_VERSION_MIN_RADICAL=0
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=34 TARGET_SDK_VERSION=34
TARGET_SDK_VERSION_INRT=29 TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=2959 VERSION_BUILD=2960
VERSION_NAME=6.6.2 Alpha VERSION_NAME=6.6.2 Alpha
VSCODE_EXT_REQUIRED_VERSION=1.0.8 VSCODE_EXT_REQUIRED_VERSION=1.0.8