tauri_plugin_android_fs/
models.rs

1use serde::{Deserialize, Serialize};
2
3/// Filters for `VisualMediaPicker`.
4#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
5pub enum VisualMediaTarget {
6
7	/// Allow only images to be selected.  
8	ImageOnly,
9
10	/// Allow only videos to be selected.  
11	VideoOnly,
12
13	/// Allow only images and videos to be selected.  
14	ImageAndVideo
15}
16
17/// The application specific directory.  
18#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
19pub enum PrivateDir {
20
21	/// The application specific persistent-data directory.  
22	/// 
23	/// The system prevents other apps from accessing these locations, and on Android 10 (API level 29) and higher, these locations are encrypted.  
24	///  
25	/// These files will be deleted when the app is uninstalled, and may also be deleted by the user.  
26	/// 
27	/// ex: `/data/user/0/{app-package-name}/files`
28	Data,
29
30	/// The application specific cache directory.  
31	/// 
32	/// The system prevents other apps from accessing these locations, and on Android 10 (API level 29) and higher, these locations are encrypted.  
33	/// 
34	/// These files will be deleted when the app is uninstalled, and may also be deleted by the user.  
35	/// The system will automatically delete files in this directory as disk space is needed elsewhere on the device.  
36	/// 
37	/// ex: `/data/user/0/{app-package-name}/cache`
38	Cache,
39}
40
41/// Directory in which to place images that are available to the user.  
42#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
43pub enum PublicImageDir {
44
45	/// Standard directory in which to place pictures that are available to the user.  
46	/// 
47	/// ex: `~/Pictures`
48	Pictures,
49
50	/// The traditional location for pictures and videos when mounting the device as a camera.  
51	/// 
52	/// ex: `~/DCIM`
53	DCIM,
54}
55
56/// Directory in which to place videos that are available to the user.  
57#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
58pub enum PublicVideoDir {
59
60	/// Standard directory in which to place movies that are available to the user.  
61	/// 
62	/// ex: `~/Movies`
63	Movies,
64
65	/// The traditional location for pictures and videos when mounting the device as a camera.  
66	/// 
67	/// ex: `~/DCIM`
68	DCIM,
69}
70
71/// Directory in which to place audios that are available to the user.  
72#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
73pub enum PublicAudioDir {
74
75	/// Standard directory in which to place movies that are available to the user.  
76	/// 
77	/// ex: `~/Music`
78	Music,
79
80	/// Standard directory in which to place any audio files that should be in the list of alarms that the user can select (not as regular music).  
81	/// 
82	/// ex: `~/Alarms`
83	Alarms,
84
85	/// Standard directory in which to place any audio files that should be in the list of audiobooks that the user can select (not as regular music).  
86	/// 
87	/// This is not available on Android 9 (API level 28) and lower.  
88    /// Availability on a given device can be verified by calling `PublicStorage::is_audiobooks_dir_available`.  
89	/// 
90	/// ex: `~/Audiobooks`  
91	Audiobooks,
92
93	/// Standard directory in which to place any audio files that should be in the list of notifications that the user can select (not as regular music).  
94	/// 
95	/// ex: `~/Notifications`
96	Notifications,
97
98	/// Standard directory in which to place any audio files that should be in the list of podcasts that the user can select (not as regular music).  
99	/// 
100	/// ex: `~/Podcasts`
101	Podcasts,
102
103	/// Standard directory in which to place any audio files that should be in the list of ringtones that the user can select (not as regular music).  
104	/// 
105	/// ex: `~/Ringtones`
106	Ringtones,
107
108	/// Standard directory in which to place any audio files that should be in the list of voice recordings recorded by voice recorder apps that the user can select (not as regular music).   
109	/// 
110	/// This is not available on Android 11 (API level 30) and lower.  
111    /// Availability on a given device can be verified by calling `PublicStorage::is_recordings_dir_available`.  
112	/// 
113	/// ex: `~/Recordings`
114	Recordings,
115}
116
117/// Directory in which to place files that are available to the user.  
118#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
119pub enum PublicGeneralPurposeDir {
120
121	/// Standard directory in which to place documents that have been created by the user.  
122	/// 
123	/// ex: `~/Documents`
124	Documents,
125
126	/// Standard directory in which to place files that have been downloaded by the user.  
127	/// 
128	/// ex: `~/Download`
129	Download,
130}
131
132
133#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, Deserialize, Serialize)]
134pub(crate) enum PublicDir {
135	#[serde(untagged)]
136	Image(PublicImageDir),
137
138	#[serde(untagged)]
139	Video(PublicVideoDir),
140
141	#[serde(untagged)]
142	Audio(PublicAudioDir),
143
144	#[serde(untagged)]
145	GeneralPurpose(PublicGeneralPurposeDir),
146}