Memperbaiki fungsi invoke #14

Merged
rizky_denianto merged 5 commits from pengembangan into main 2026-07-16 23:22:06 +07:00
12 changed files with 6 additions and 160 deletions
Showing only changes of commit c195d2bc99 - Show all commits

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
const COMMANDS: &[&str] = &["cek_izin", "minta_izin", "daftar_perangkat", "kirim"];
const COMMANDS: &[&str] = &["daftar_perangkat", "kirim"];
fn main() {
tauri_plugin::Builder::new(COMMANDS)
-11
View File
@@ -1,22 +1,11 @@
import { invoke } from "@tauri-apps/api/core";
import { SBlueclasMuatanKirim, SBlueclasResponDaftarPerangkat } from "./models";
export async function cekIzin(): Promise<string> {
return await invoke<string>("plugin:bluclas|cek_izin", {}).then(
(res: string) => res,
);
}
export async function mintaIzin(): Promise<null> {
return await invoke<null>("plugin:bluclas|minta_izin", {});
}
export async function daftarPerangkat(): Promise<
SBlueclasResponDaftarPerangkat[]
> {
return await invoke<SBlueclasResponDaftarPerangkat[]>(
"plugin:bluclas|daftar_perangkat",
{},
).then((res: SBlueclasResponDaftarPerangkat[]) => res);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@segubi/tauri-plugin-bluclas-api",
"version": "0.1.2",
"version": "0.1.3",
"author": "Rizky Denianto",
"description": "",
"type": "module",
@@ -1,13 +0,0 @@
# 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"]
@@ -1,13 +0,0 @@
# 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"]
-54
View File
@@ -4,8 +4,6 @@ Default permissions for the plugin
#### This default permission set includes the following:
- `allow-cek-izin`
- `allow-minta-izin`
- `allow-daftar-perangkat`
- `allow-kirim`
@@ -18,32 +16,6 @@ Default permissions for the plugin
</tr>
<tr>
<td>
`bluclas:allow-cek-izin`
</td>
<td>
Enables the cek_izin command without any pre-configured scope.
</td>
</tr>
<tr>
<td>
`bluclas:deny-cek-izin`
</td>
<td>
Denies the cek_izin command without any pre-configured scope.
</td>
</tr>
<tr>
<td>
@@ -93,32 +65,6 @@ Enables the kirim command without any pre-configured scope.
Denies the kirim command without any pre-configured scope.
</td>
</tr>
<tr>
<td>
`bluclas:allow-minta-izin`
</td>
<td>
Enables the minta_izin command without any pre-configured scope.
</td>
</tr>
<tr>
<td>
`bluclas:deny-minta-izin`
</td>
<td>
Denies the minta_izin command without any pre-configured scope.
</td>
</tr>
</table>
-2
View File
@@ -1,8 +1,6 @@
[default]
description = "Default permissions for the plugin"
permissions = [
"allow-cek-izin",
"allow-minta-izin",
"allow-daftar-perangkat",
"allow-kirim"
]
+2 -26
View File
@@ -294,18 +294,6 @@
"PermissionKind": {
"type": "string",
"oneOf": [
{
"description": "Enables the cek_izin command without any pre-configured scope.",
"type": "string",
"const": "allow-cek-izin",
"markdownDescription": "Enables the cek_izin command without any pre-configured scope."
},
{
"description": "Denies the cek_izin command without any pre-configured scope.",
"type": "string",
"const": "deny-cek-izin",
"markdownDescription": "Denies the cek_izin command without any pre-configured scope."
},
{
"description": "Enables the daftar_perangkat command without any pre-configured scope.",
"type": "string",
@@ -331,22 +319,10 @@
"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- `allow-cek-izin`\n- `allow-minta-izin`\n- `allow-daftar-perangkat`\n- `allow-kirim`",
"description": "Default permissions for the plugin\n#### This default permission set includes:\n\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-cek-izin`\n- `allow-minta-izin`\n- `allow-daftar-perangkat`\n- `allow-kirim`"
"markdownDescription": "Default permissions for the plugin\n#### This default permission set includes:\n\n- `allow-daftar-perangkat`\n- `allow-kirim`"
}
]
}
-10
View File
@@ -4,16 +4,6 @@ use crate::BluclasExt;
use crate::Result;
use crate::models::*;
#[command]
pub(crate) async fn cek_izin<R: Runtime>(app: AppHandle<R>) -> Result<String> {
return app.bluclas().cek_izin();
}
#[command]
pub(crate) async fn minta_izin<R: Runtime>(app: AppHandle<R>) -> Result<()> {
return app.bluclas().minta_izin();
}
#[command]
pub(crate) async fn daftar_perangkat<R: Runtime>(
app: AppHandle<R>,
-8
View File
@@ -14,14 +14,6 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
pub struct Bluclas<R: Runtime>(AppHandle<R>);
impl<R: Runtime> Bluclas<R> {
pub fn cek_izin(&self) -> crate::Result<String> {
return Ok(String::new());
}
pub fn minta_izin(&self) -> crate::Result<()> {
return Ok(());
}
pub fn daftar_perangkat(&self) -> crate::Result<SBlueclasResponDaftarPerangkat> {
return Ok(SBlueclasResponDaftarPerangkat { data: vec![] });
}
+2 -7
View File
@@ -1,4 +1,4 @@
use crate::commands::{cek_izin, daftar_perangkat, kirim, minta_izin};
use crate::commands::{daftar_perangkat, kirim};
use tauri::{
Manager, Runtime,
plugin::{Builder, TauriPlugin},
@@ -36,12 +36,7 @@ impl<R: Runtime, T: Manager<R>> crate::BluclasExt<R> for T {
/// Initializes the plugin.
pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::new("bluclas")
.invoke_handler(tauri::generate_handler![
cek_izin,
minta_izin,
daftar_perangkat,
kirim
])
.invoke_handler(tauri::generate_handler![daftar_perangkat, kirim])
.setup(|app, api| {
#[cfg(mobile)]
let bluclas = mobile::init(app, api)?;
-14
View File
@@ -25,20 +25,6 @@ pub fn init<R: Runtime, C: DeserializeOwned>(
pub struct Bluclas<R: Runtime>(PluginHandle<R>);
impl<R: Runtime> Bluclas<R> {
pub fn cek_izin(&self) -> crate::Result<String> {
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<SBlueclasResponDaftarPerangkat> {
return self
.0