Menambah izin dan coba menggunakan program kotlin lama
This commit is contained in:
1 parent
2777aaea84
commit
f2dcab4ca4
8 files changed
+117
-13
No files matched your search
@@ -45,19 +45,12 @@ class BluclasPlugin(private val activity: Activity) : Plugin(activity) {
|
|||||||
|
|
||||||
@Command
|
@Command
|
||||||
override fun checkPermissions(invoke: Invoke) {
|
override fun checkPermissions(invoke: Invoke) {
|
||||||
val result = JSObject()
|
super.checkPermissions(invoke)
|
||||||
result.put("bluetooth", getPermissionState("bluetooth").toString())
|
|
||||||
invoke.resolve(result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
override fun requestPermissions(invoke: Invoke) {
|
override fun requestPermissions(invoke: Invoke) {
|
||||||
requestPermissionForAlias("bluetooth", invoke, "permissionsCallback")
|
super.requestPermissions(invoke)
|
||||||
}
|
|
||||||
|
|
||||||
@PermissionCallback
|
|
||||||
private fun permissionsCallback(invoke: Invoke) {
|
|
||||||
checkPermissions(invoke)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
const COMMANDS: &[&str] = &["daftar_perangkat", "kirim"];
|
const COMMANDS: &[&str] = &[
|
||||||
|
"check_permissions",
|
||||||
|
"request_permissions",
|
||||||
|
"daftar_perangkat",
|
||||||
|
"kirim",
|
||||||
|
];
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri_plugin::Builder::new(COMMANDS)
|
tauri_plugin::Builder::new(COMMANDS)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@segubi/tauri-plugin-bluclas-api",
|
"name": "@segubi/tauri-plugin-bluclas-api",
|
||||||
"version": "0.1.4",
|
"version": "0.1.5",
|
||||||
"author": "Rizky Denianto",
|
"author": "Rizky Denianto",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Automatically generated - DO NOT EDIT!
|
||||||
|
|
||||||
|
"$schema" = "../../schemas/schema.json"
|
||||||
|
|
||||||
|
[[permission]]
|
||||||
|
identifier = "allow-check-permissions"
|
||||||
|
description = "Enables the check_permissions command without any pre-configured scope."
|
||||||
|
commands.allow = ["check_permissions"]
|
||||||
|
|
||||||
|
[[permission]]
|
||||||
|
identifier = "deny-check-permissions"
|
||||||
|
description = "Denies the check_permissions command without any pre-configured scope."
|
||||||
|
commands.deny = ["check_permissions"]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Automatically generated - DO NOT EDIT!
|
||||||
|
|
||||||
|
"$schema" = "../../schemas/schema.json"
|
||||||
|
|
||||||
|
[[permission]]
|
||||||
|
identifier = "allow-request-permissions"
|
||||||
|
description = "Enables the request_permissions command without any pre-configured scope."
|
||||||
|
commands.allow = ["request_permissions"]
|
||||||
|
|
||||||
|
[[permission]]
|
||||||
|
identifier = "deny-request-permissions"
|
||||||
|
description = "Denies the request_permissions command without any pre-configured scope."
|
||||||
|
commands.deny = ["request_permissions"]
|
||||||
@@ -4,6 +4,8 @@ Default permissions for the plugin
|
|||||||
|
|
||||||
#### This default permission set includes the following:
|
#### This default permission set includes the following:
|
||||||
|
|
||||||
|
- `allow-check-permissions`
|
||||||
|
- `allow-request-permissions`
|
||||||
- `allow-daftar-perangkat`
|
- `allow-daftar-perangkat`
|
||||||
- `allow-kirim`
|
- `allow-kirim`
|
||||||
|
|
||||||
@@ -16,6 +18,32 @@ Default permissions for the plugin
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
`bluclas:allow-check-permissions`
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
Enables the check_permissions command without any pre-configured scope.
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
`bluclas:deny-check-permissions`
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
Denies the check_permissions command without any pre-configured scope.
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
@@ -65,6 +93,32 @@ Enables the kirim command without any pre-configured scope.
|
|||||||
|
|
||||||
Denies the kirim command without any pre-configured scope.
|
Denies the kirim command without any pre-configured scope.
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
`bluclas:allow-request-permissions`
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
Enables the request_permissions command without any pre-configured scope.
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
`bluclas:deny-request-permissions`
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
Denies the request_permissions command without any pre-configured scope.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
[default]
|
[default]
|
||||||
description = "Default permissions for the plugin"
|
description = "Default permissions for the plugin"
|
||||||
permissions = [
|
permissions = [
|
||||||
|
"allow-check-permissions",
|
||||||
|
"allow-request-permissions",
|
||||||
"allow-daftar-perangkat",
|
"allow-daftar-perangkat",
|
||||||
"allow-kirim"
|
"allow-kirim"
|
||||||
]
|
]
|
||||||
@@ -294,6 +294,18 @@
|
|||||||
"PermissionKind": {
|
"PermissionKind": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"description": "Enables the check_permissions command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "allow-check-permissions",
|
||||||
|
"markdownDescription": "Enables the check_permissions command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the check_permissions command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deny-check-permissions",
|
||||||
|
"markdownDescription": "Denies the check_permissions command without any pre-configured scope."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Enables the daftar_perangkat command without any pre-configured scope.",
|
"description": "Enables the daftar_perangkat command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -319,10 +331,22 @@
|
|||||||
"markdownDescription": "Denies the kirim command without any pre-configured scope."
|
"markdownDescription": "Denies the kirim command without any pre-configured scope."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-daftar-perangkat`\n- `allow-kirim`",
|
"description": "Enables the request_permissions command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "allow-request-permissions",
|
||||||
|
"markdownDescription": "Enables the request_permissions command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the request_permissions command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "deny-request-permissions",
|
||||||
|
"markdownDescription": "Denies the request_permissions command without any pre-configured scope."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-check-permissions`\n- `allow-request-permissions`\n- `allow-daftar-perangkat`\n- `allow-kirim`",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "default",
|
"const": "default",
|
||||||
"markdownDescription": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-daftar-perangkat`\n- `allow-kirim`"
|
"markdownDescription": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-check-permissions`\n- `allow-request-permissions`\n- `allow-daftar-perangkat`\n- `allow-kirim`"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user