plugin_framework, ui tmp

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-20 22:53:43 +08:00
parent 9a08e0bed4
commit 1b303b7b27
11 changed files with 147 additions and 93 deletions

View File

@@ -1406,7 +1406,7 @@ pub fn plugin_event(_id: String, _event: Vec<u8>) {
}
#[inline]
pub fn plugin_get_session_option(_id: String, _peer: String, _key: String) -> SyncReturn<String> {
pub fn plugin_get_session_option(_id: String, _peer: String, _key: String) -> SyncReturn<Option<String>> {
#[cfg(feature = "plugin_framework")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{
@@ -1417,7 +1417,9 @@ pub fn plugin_get_session_option(_id: String, _peer: String, _key: String) -> Sy
target_os = "android",
target_os = "ios"
))]
return SyncReturn("".to_owned());
{
return SyncReturn(None);
}
}
#[inline]
@@ -1430,18 +1432,20 @@ pub fn plugin_set_session_option(_id: String, _peer: String, _key: String, _valu
}
#[inline]
pub fn plugin_get_local_option(_id: String, _key: String) -> SyncReturn<String> {
pub fn plugin_get_local_option(_id: String, _key: String) -> SyncReturn<Option<String>> {
#[cfg(feature = "plugin_framework")]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{
allow_err!(crate::plugin::LocalConfig::get(&_id, &key));
return SyncReturn(crate::plugin::LocalConfig::get(&_id, &_key));
}
#[cfg(any(
not(feature = "plugin_framework"),
target_os = "android",
target_os = "ios"
))]
return SyncReturn("".to_owned());
{
return SyncReturn(None);
}
}
#[inline]

View File

@@ -8,7 +8,7 @@ use std::ffi::{c_char, CStr};
pub struct UiButton {
key: String,
text: String,
icon: String,
icon: String, // icon can be int in flutter, but string in other ui framework. And it is flexible to use string.
tooltip: String,
action: String, // The action to be triggered when the button is clicked.
}