Skip to content

Commit

Permalink
fix(all): format + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Nov 8, 2023
1 parent 7c43550 commit 2621556
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
18 changes: 8 additions & 10 deletions src-tauri/src/init.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use tauri::Manager;

use crate::injection::injection_runner;
use std::{time::Duration, sync::Arc};
use std::{sync::Arc, time::Duration};

// Global "is injected" var
static mut IS_READY: bool = false;
Expand All @@ -22,14 +22,12 @@ pub fn inject_routine(win: tauri::Window) {
IS_READY = true;
println!("JS context ready!");

let win = evt_app
.get_window("main");
let win = evt_app.get_window("main");

// Set window.dorion to true in the window
if let Some(win) = win {
win.eval("window.dorion = true")
.unwrap_or_default();

win.eval("window.dorion = true").unwrap_or_default();

injection_runner::do_injection(win);
}
});
Expand All @@ -47,11 +45,11 @@ pub fn inject_routine(win: tauri::Window) {
// Send javascript that sends the "initial_inject" event
//
// If it succeeds, that means the web context is ready
let win = app
.get_window("main");

let win = app.get_window("main");

if let Some(win) = win {
win.eval("!window.dorion && window.__TAURI__.event.emit('initial_inject')")
win
.eval("!window.dorion && window.__TAURI__.event.emit('initial_inject')")
.unwrap_or_default();
}

Expand Down
14 changes: 6 additions & 8 deletions src-tauri/src/injection/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ pub fn load_plugins(preload_only: Option<bool>) -> Result<HashMap<String, String
let mut plugin_list = HashMap::new();
let plugins_dir = get_plugin_dir();

let plugin_folders = fs::read_dir(&plugins_dir)
.map_err(|e| format!("Error reading directory: {}", e))?;
let plugin_folders =
fs::read_dir(&plugins_dir).map_err(|e| format!("Error reading directory: {}", e))?;

for entry in plugin_folders {
let full_path =
entry.map_err(|e| format!("Error reading directory entry: {}", e))?;
let full_path = entry.map_err(|e| format!("Error reading directory entry: {}", e))?;
let meta = full_path
.metadata()
.map_err(|e| format!("Error getting metadata: {}", e))?;
Expand Down Expand Up @@ -90,12 +89,11 @@ pub fn get_plugin_list() -> Result<Vec<Plugin>, String> {
let plugins_dir = get_plugin_dir();
let mut plugin_list: Vec<Plugin> = Vec::new();

let plugin_folders = fs::read_dir(&plugins_dir)
.map_err(|e| format!("Error reading directory: {}", e))?;
let plugin_folders =
fs::read_dir(&plugins_dir).map_err(|e| format!("Error reading directory: {}", e))?;

for entry in plugin_folders {
let full_path =
entry.map_err(|e| format!("Error reading directory entry: {}", e))?;
let full_path = entry.map_err(|e| format!("Error reading directory entry: {}", e))?;
let meta = full_path
.metadata()
.map_err(|e| format!("Error getting metadata: {}", e))?;
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/util/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ pub fn send_notification(win: tauri::Window, title: String, body: String) {
let app = win.app_handle();

notification::Notification::new(&app.config().tauri.bundle.identifier)
.title(&title)
.body(&body)
.title(title)
.body(body)
.notify(&app)
.unwrap_or_default();
}
Expand Down

0 comments on commit 2621556

Please sign in to comment.