Refactor desktop into App type

This commit is contained in:
Jonathan Kelley committed 2024-01-04 16:12:37 -08:00
1 parent f6acaba061
commit 9a6d745339
15 files changed
+728 -645

No files matched your search

+20 -2
View File
@@ -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 {