diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index 9a40236..87ebec0 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,3 +1,6 @@
+
+
+
diff --git a/build.rs b/build.rs
index e0ff2cc..730d157 100644
--- a/build.rs
+++ b/build.rs
@@ -1,8 +1,8 @@
-const COMMANDS: &[&str] = &["ping"];
+const COMMANDS: &[&str] = &["cek_izin", "minta_izin", "daftar_perangkat", "kirim"];
fn main() {
- tauri_plugin::Builder::new(COMMANDS)
- .android_path("android")
- .ios_path("ios")
- .build();
+ tauri_plugin::Builder::new(COMMANDS)
+ .android_path("android")
+ .ios_path("ios")
+ .build();
}
diff --git a/permissions/autogenerated/commands/cek_izin.toml b/permissions/autogenerated/commands/cek_izin.toml
new file mode 100644
index 0000000..0e4fefe
--- /dev/null
+++ b/permissions/autogenerated/commands/cek_izin.toml
@@ -0,0 +1,13 @@
+# Automatically generated - DO NOT EDIT!
+
+"$schema" = "../../schemas/schema.json"
+
+[[permission]]
+identifier = "allow-cek-izin"
+description = "Enables the cek_izin command without any pre-configured scope."
+commands.allow = ["cek_izin"]
+
+[[permission]]
+identifier = "deny-cek-izin"
+description = "Denies the cek_izin command without any pre-configured scope."
+commands.deny = ["cek_izin"]
diff --git a/permissions/autogenerated/commands/daftar_perangkat.toml b/permissions/autogenerated/commands/daftar_perangkat.toml
new file mode 100644
index 0000000..a4b4967
--- /dev/null
+++ b/permissions/autogenerated/commands/daftar_perangkat.toml
@@ -0,0 +1,13 @@
+# Automatically generated - DO NOT EDIT!
+
+"$schema" = "../../schemas/schema.json"
+
+[[permission]]
+identifier = "allow-daftar-perangkat"
+description = "Enables the daftar_perangkat command without any pre-configured scope."
+commands.allow = ["daftar_perangkat"]
+
+[[permission]]
+identifier = "deny-daftar-perangkat"
+description = "Denies the daftar_perangkat command without any pre-configured scope."
+commands.deny = ["daftar_perangkat"]
diff --git a/permissions/autogenerated/commands/kirim.toml b/permissions/autogenerated/commands/kirim.toml
new file mode 100644
index 0000000..46f8f38
--- /dev/null
+++ b/permissions/autogenerated/commands/kirim.toml
@@ -0,0 +1,13 @@
+# Automatically generated - DO NOT EDIT!
+
+"$schema" = "../../schemas/schema.json"
+
+[[permission]]
+identifier = "allow-kirim"
+description = "Enables the kirim command without any pre-configured scope."
+commands.allow = ["kirim"]
+
+[[permission]]
+identifier = "deny-kirim"
+description = "Denies the kirim command without any pre-configured scope."
+commands.deny = ["kirim"]
diff --git a/permissions/autogenerated/commands/minta_izin.toml b/permissions/autogenerated/commands/minta_izin.toml
new file mode 100644
index 0000000..e406f3f
--- /dev/null
+++ b/permissions/autogenerated/commands/minta_izin.toml
@@ -0,0 +1,13 @@
+# Automatically generated - DO NOT EDIT!
+
+"$schema" = "../../schemas/schema.json"
+
+[[permission]]
+identifier = "allow-minta-izin"
+description = "Enables the minta_izin command without any pre-configured scope."
+commands.allow = ["minta_izin"]
+
+[[permission]]
+identifier = "deny-minta-izin"
+description = "Denies the minta_izin command without any pre-configured scope."
+commands.deny = ["minta_izin"]
diff --git a/permissions/autogenerated/commands/ping.toml b/permissions/autogenerated/commands/ping.toml
deleted file mode 100644
index 1d13588..0000000
--- a/permissions/autogenerated/commands/ping.toml
+++ /dev/null
@@ -1,13 +0,0 @@
-# Automatically generated - DO NOT EDIT!
-
-"$schema" = "../../schemas/schema.json"
-
-[[permission]]
-identifier = "allow-ping"
-description = "Enables the ping command without any pre-configured scope."
-commands.allow = ["ping"]
-
-[[permission]]
-identifier = "deny-ping"
-description = "Denies the ping command without any pre-configured scope."
-commands.deny = ["ping"]
diff --git a/permissions/autogenerated/reference.md b/permissions/autogenerated/reference.md
index 6d8c8ea..09e2929 100644
--- a/permissions/autogenerated/reference.md
+++ b/permissions/autogenerated/reference.md
@@ -4,7 +4,10 @@ Default permissions for the plugin
#### This default permission set includes the following:
-- `allow-ping`
+- `cek_izin`
+- `minta_izin`
+- `daftar_perangkat`
+- `kirim`
## Permission Table
@@ -18,12 +21,12 @@ Default permissions for the plugin
|
-`bluclas:allow-ping`
+`bluclas:allow-cek-izin`
|
-Enables the ping command without any pre-configured scope.
+Enables the cek_izin command without any pre-configured scope.
|
@@ -31,12 +34,90 @@ Enables the ping command without any pre-configured scope.
|
-`bluclas:deny-ping`
+`bluclas:deny-cek-izin`
|
-Denies the ping command without any pre-configured scope.
+Denies the cek_izin command without any pre-configured scope.
+
+ |
+
+
+
+|
+
+`bluclas:allow-daftar-perangkat`
+
+ |
+
+
+Enables the daftar_perangkat command without any pre-configured scope.
+
+ |
+
+
+
+|
+
+`bluclas:deny-daftar-perangkat`
+
+ |
+
+
+Denies the daftar_perangkat command without any pre-configured scope.
+
+ |
+
+
+
+|
+
+`bluclas:allow-kirim`
+
+ |
+
+
+Enables the kirim command without any pre-configured scope.
+
+ |
+
+
+
+|
+
+`bluclas:deny-kirim`
+
+ |
+
+
+Denies the kirim command without any pre-configured scope.
+
+ |
+
+
+
+|
+
+`bluclas:allow-minta-izin`
+
+ |
+
+
+Enables the minta_izin command without any pre-configured scope.
+
+ |
+
+
+
+|
+
+`bluclas:deny-minta-izin`
+
+ |
+
+
+Denies the minta_izin command without any pre-configured scope.
|
diff --git a/permissions/default.toml b/permissions/default.toml
index cc5a76f..046948f 100644
--- a/permissions/default.toml
+++ b/permissions/default.toml
@@ -1,3 +1,8 @@
[default]
description = "Default permissions for the plugin"
-permissions = ["allow-ping"]
+permissions = [
+ "cek_izin",
+ "minta_izin",
+ "daftar_perangkat",
+ "kirim"
+]
diff --git a/permissions/schemas/schema.json b/permissions/schemas/schema.json
index ac68e12..0d37449 100644
--- a/permissions/schemas/schema.json
+++ b/permissions/schemas/schema.json
@@ -295,22 +295,58 @@
"type": "string",
"oneOf": [
{
- "description": "Enables the ping command without any pre-configured scope.",
+ "description": "Enables the cek_izin command without any pre-configured scope.",
"type": "string",
- "const": "allow-ping",
- "markdownDescription": "Enables the ping command without any pre-configured scope."
+ "const": "allow-cek-izin",
+ "markdownDescription": "Enables the cek_izin command without any pre-configured scope."
},
{
- "description": "Denies the ping command without any pre-configured scope.",
+ "description": "Denies the cek_izin command without any pre-configured scope.",
"type": "string",
- "const": "deny-ping",
- "markdownDescription": "Denies the ping command without any pre-configured scope."
+ "const": "deny-cek-izin",
+ "markdownDescription": "Denies the cek_izin command without any pre-configured scope."
},
{
- "description": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-ping`",
+ "description": "Enables the daftar_perangkat command without any pre-configured scope.",
+ "type": "string",
+ "const": "allow-daftar-perangkat",
+ "markdownDescription": "Enables the daftar_perangkat command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the daftar_perangkat command without any pre-configured scope.",
+ "type": "string",
+ "const": "deny-daftar-perangkat",
+ "markdownDescription": "Denies the daftar_perangkat command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the kirim command without any pre-configured scope.",
+ "type": "string",
+ "const": "allow-kirim",
+ "markdownDescription": "Enables the kirim command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the kirim command without any pre-configured scope.",
+ "type": "string",
+ "const": "deny-kirim",
+ "markdownDescription": "Denies the kirim command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the minta_izin command without any pre-configured scope.",
+ "type": "string",
+ "const": "allow-minta-izin",
+ "markdownDescription": "Enables the minta_izin command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the minta_izin command without any pre-configured scope.",
+ "type": "string",
+ "const": "deny-minta-izin",
+ "markdownDescription": "Denies the minta_izin command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `cek_izin`\n- `minta_izin`\n- `daftar_perangkat`\n- `kirim`",
"type": "string",
"const": "default",
- "markdownDescription": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-ping`"
+ "markdownDescription": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `cek_izin`\n- `minta_izin`\n- `daftar_perangkat`\n- `kirim`"
}
]
}
diff --git a/src/commands.rs b/src/commands.rs
index ec5f82d..a91c47d 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -4,6 +4,16 @@ use crate::BluclasExt;
use crate::Result;
use crate::models::*;
+#[command]
+pub(crate) async fn cek_izin(app: AppHandle) -> Result {
+ return app.bluclas().cek_izin();
+}
+
+#[command]
+pub(crate) async fn minta_izin(app: AppHandle) -> Result<()> {
+ return app.bluclas().minta_izin();
+}
+
#[command]
pub(crate) async fn daftar_perangkat(
app: AppHandle,
diff --git a/src/desktop.rs b/src/desktop.rs
index 5f6ee09..fc61630 100644
--- a/src/desktop.rs
+++ b/src/desktop.rs
@@ -14,6 +14,14 @@ pub fn init(
pub struct Bluclas(AppHandle);
impl Bluclas {
+ pub fn cek_izin(&self) -> crate::Result {
+ return Ok(false);
+ }
+
+ pub fn minta_izin(&self) -> crate::Result<()> {
+ return Ok(());
+ }
+
pub fn daftar_perangkat(&self) -> crate::Result {
return Ok(SBlueclasResponDaftarPerangkat { data: vec![] });
}
diff --git a/src/lib.rs b/src/lib.rs
index 367cd81..f8f9229 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,7 @@
+use crate::commands::{cek_izin, daftar_perangkat, kirim, minta_izin};
use tauri::{
- plugin::{Builder, TauriPlugin},
Manager, Runtime,
+ plugin::{Builder, TauriPlugin},
};
pub use models::*;
@@ -36,8 +37,10 @@ impl> crate::BluclasExt for T {
pub fn init() -> TauriPlugin {
Builder::new("bluclas")
.invoke_handler(tauri::generate_handler![
- commands::daftar_perangkat,
- commands::kirim
+ cek_izin,
+ minta_izin,
+ daftar_perangkat,
+ kirim
])
.setup(|app, api| {
#[cfg(mobile)]
diff --git a/src/mobile.rs b/src/mobile.rs
index f976f48..41b88b8 100644
--- a/src/mobile.rs
+++ b/src/mobile.rs
@@ -25,6 +25,20 @@ pub fn init(
pub struct Bluclas(PluginHandle);
impl Bluclas {
+ pub fn cek_izin(&self) -> crate::Result {
+ return self
+ .0
+ .run_mobile_plugin("checkPermissions", ())
+ .map_err(Into::into);
+ }
+
+ pub fn minta_izin(&self) -> crate::Result<()> {
+ return self
+ .0
+ .run_mobile_plugin("requestPermissions", ())
+ .map_err(Into::into);
+ }
+
pub fn daftar_perangkat(&self) -> crate::Result {
return self
.0