6.6.2 - Alpha - 修复 notice 模块缺失 getBuilder 等扩展方法的问题 (issue #301)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<Pair<String, Supplier<Any?>>>(
|
||||
"builder" to Supplier { getBuilder(scriptRuntime, emptyArray()) }
|
||||
)
|
||||
|
||||
@Suppress("UnnecessaryVariable")
|
||||
override fun invoke(vararg args: Any?): Int = ensureArgumentsAtMost(args, 3) { argList ->
|
||||
val (arg0, arg1, arg2) = argList
|
||||
|
||||
Reference in New Issue
Block a user