Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Navigation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Sep 24, 2022
1 parent 947e63c commit 7f8368b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 8 additions & 0 deletions core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ fn main() {

let window = app.get_window("main").unwrap();

app.emit_all(
"openCodes",
Payload {
message: "Open codes page".into(),
},
)
.unwrap();

window.show().unwrap();
window.unminimize().unwrap();
window.set_focus().unwrap();
Expand Down
14 changes: 10 additions & 4 deletions interface/libraries/shortcuts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { globalShortcut, invoke, window } from "@tauri-apps/api"
import { exit } from "@tauri-apps/api/process"
import { getSettings, setSettings } from "interface/stores/settings"
import { getState } from "interface/stores/state"
import { navigate } from "./navigate"

const settings = getSettings()
const state = getState()
let modify = true
let inputName: HTMLInputElement

Expand Down Expand Up @@ -142,20 +144,24 @@ export const registerShortcuts = () => {
await window.appWindow.unminimize()
await window.appWindow.setFocus()
}

if (state.authenticated === true) {
navigate("codes")
}
})
}

if (settings.shortcuts.settings !== "None") {
globalShortcut.register(settings.shortcuts.settings, async () => {
const windowShown = await window.appWindow.isVisible()

if (windowShown === true) {
navigate("settings")
} else {
if (windowShown === false) {
window.appWindow.show()
}

navigate("settings")
if (state.authenticated === true) {
navigate("settings")
}
})
}

Expand Down
2 changes: 0 additions & 2 deletions interface/windows/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export const clearData = async () => {

navigate("/")
location.reload()

navigate("codes")
}
}

Expand Down

0 comments on commit 7f8368b

Please sign in to comment.