diff --git a/android/src/main/java/BluclasPlugin.kt b/android/src/main/java/BluclasPlugin.kt index ebb2047..f9d46d0 100644 --- a/android/src/main/java/BluclasPlugin.kt +++ b/android/src/main/java/BluclasPlugin.kt @@ -45,19 +45,12 @@ class BluclasPlugin(private val activity: Activity) : Plugin(activity) { @Command override fun checkPermissions(invoke: Invoke) { - val result = JSObject() - result.put("bluetooth", getPermissionState("bluetooth").toString()) - invoke.resolve(result) + super.checkPermissions(invoke) } @Command override fun requestPermissions(invoke: Invoke) { - requestPermissionForAlias("bluetooth", invoke, "permissionsCallback") - } - - @PermissionCallback - private fun permissionsCallback(invoke: Invoke) { - checkPermissions(invoke) + super.requestPermissions(invoke) } @Command diff --git a/build.rs b/build.rs index 52293eb..a486007 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,9 @@ -const COMMANDS: &[&str] = &["daftar_perangkat", "kirim"]; +const COMMANDS: &[&str] = &[ + "check_permissions", + "request_permissions", + "daftar_perangkat", + "kirim", +]; fn main() { tauri_plugin::Builder::new(COMMANDS) diff --git a/package.json b/package.json index 827fbc7..3a9cc51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@segubi/tauri-plugin-bluclas-api", - "version": "0.1.4", + "version": "0.1.5", "author": "Rizky Denianto", "description": "", "type": "module", diff --git a/permissions/autogenerated/commands/check_permissions.toml b/permissions/autogenerated/commands/check_permissions.toml new file mode 100644 index 0000000..f5af08b --- /dev/null +++ b/permissions/autogenerated/commands/check_permissions.toml @@ -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"] diff --git a/permissions/autogenerated/commands/request_permissions.toml b/permissions/autogenerated/commands/request_permissions.toml new file mode 100644 index 0000000..02dcd62 --- /dev/null +++ b/permissions/autogenerated/commands/request_permissions.toml @@ -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"] diff --git a/permissions/autogenerated/reference.md b/permissions/autogenerated/reference.md index e1ced02..0d7056b 100644 --- a/permissions/autogenerated/reference.md +++ b/permissions/autogenerated/reference.md @@ -4,6 +4,8 @@ Default permissions for the plugin #### This default permission set includes the following: +- `allow-check-permissions` +- `allow-request-permissions` - `allow-daftar-perangkat` - `allow-kirim` @@ -16,6 +18,32 @@ Default permissions for the plugin + + + +`bluclas:allow-check-permissions` + + + + +Enables the check_permissions command without any pre-configured scope. + + + + + + + +`bluclas:deny-check-permissions` + + + + +Denies the check_permissions command without any pre-configured scope. + + + + @@ -65,6 +93,32 @@ Enables the kirim command without any pre-configured scope. Denies the kirim command without any pre-configured scope. + + + + + + +`bluclas:allow-request-permissions` + + + + +Enables the request_permissions command without any pre-configured scope. + + + + + + + +`bluclas:deny-request-permissions` + + + + +Denies the request_permissions command without any pre-configured scope. + diff --git a/permissions/default.toml b/permissions/default.toml index c7f297b..473ca86 100644 --- a/permissions/default.toml +++ b/permissions/default.toml @@ -1,6 +1,8 @@ [default] description = "Default permissions for the plugin" permissions = [ + "allow-check-permissions", + "allow-request-permissions", "allow-daftar-perangkat", "allow-kirim" ] diff --git a/permissions/schemas/schema.json b/permissions/schemas/schema.json index d166461..21b10d7 100644 --- a/permissions/schemas/schema.json +++ b/permissions/schemas/schema.json @@ -294,6 +294,18 @@ "PermissionKind": { "type": "string", "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.", "type": "string", @@ -319,10 +331,22 @@ "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", "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`" } ] }