Refactor desktop into App type
This commit is contained in:
15 files changed
+728
-645
No files matched your search
@@ -8,9 +8,27 @@ pub struct IpcMessage {
|
||||
params: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug, Clone)]
|
||||
pub enum KnownIpcMethod<'a> {
|
||||
FileDialog,
|
||||
UserEvent,
|
||||
Query,
|
||||
BrowserOpen,
|
||||
Initialize,
|
||||
Other(&'a str),
|
||||
}
|
||||
|
||||
impl IpcMessage {
|
||||
pub(crate) fn method(&self) -> &str {
|
||||
self.method.as_str()
|
||||
pub(crate) fn method(&self) -> KnownIpcMethod {
|
||||
match self.method.as_str() {
|
||||
// todo: this is a misspelling
|
||||
"file_diolog" => KnownIpcMethod::FileDialog,
|
||||
"user_event" => KnownIpcMethod::UserEvent,
|
||||
"query" => KnownIpcMethod::Query,
|
||||
"browser_open" => KnownIpcMethod::BrowserOpen,
|
||||
"initialize" => KnownIpcMethod::Initialize,
|
||||
_ => KnownIpcMethod::Other(&self.method),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn params(self) -> serde_json::Value {
|
||||
|
||||
Reference in new issue
Block a user