1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use ;
use crate::;
/// The main command to share content.
///
/// This command accepts a `ShareOptions` struct containing the content to be shared.
/// It creates and displays the native sharing dialog for the current platform.
///
/// The temporary files created for sharing will be automatically managed and
/// cleaned up.
///
/// ## Arguments
///
/// * `app`: The Tauri application handle.
/// * `window`: The Tauri window from which the sharing dialog will be shown.
/// * `options`: A `ShareOptions` struct defining the content to share.
/// * `state`: The `PluginTempFileManager` state, used internally to manage file cleanup.
///
/// ## Example
///
/// See the plugin's frontend usage example in the `lib.rs` file.
pub async
/// Checks if the native sharing dialog is available on the current platform.
///
/// This is useful for conditionally showing a share button in the frontend.
/// It returns `true` on Windows, macOS, and mobile, and `false` on Linux.
///
/// ## Arguments
///
/// * `app`: The Tauri application handle.
///
/// ## Returns
///
/// A `CanShareResult` struct containing a boolean value.
pub async
/// Manually triggers the cleanup of temporary files.
///
/// While file cleanup is automatically handled when the app exits, this command
/// can be used to manually force a cleanup, for example, after a file is shared
/// and is no longer needed by the plugin.
///
/// ## Arguments
///
/// * `app`: The Tauri application handle.
pub async