diff --git a/package.json b/package.json index 441d0f5e..b74c6af9 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@tauri-apps/plugin-autostart": "~2", "@tauri-apps/plugin-fs": "^2.0.0", "@tauri-apps/plugin-log": "~2", - "@tauri-apps/plugin-os": "~2.0.0", + "@tauri-apps/plugin-os": "~2", "@tauri-apps/plugin-process": "^2.0.0", "@tauri-apps/plugin-shell": "^2.0.0", "@tauri-apps/plugin-store": "~2", diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 772252e2..38f8bbf3 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -23,6 +23,7 @@ use std::time::Duration; fn build_and_run_app(app: AppState) { tauri::Builder::default() + .plugin(tauri_plugin_os::init()) .setup(|app| { let handle = app.handle().clone(); let state = AppState::new(); diff --git a/src/components/area-chart.tsx b/src/components/area-chart.tsx index 6eecaf0e..3c29071a 100644 --- a/src/components/area-chart.tsx +++ b/src/components/area-chart.tsx @@ -101,7 +101,7 @@ export const useAreaChartState = ( title: { text: null, }, - startOnTick: true, + // startOnTick: true, endOnTick: true, gridLineColor: other.charts.area.default.gridLineColor, diff --git a/src/lib/store.ts b/src/lib/store.ts index e860a9cd..f8e39fcf 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -1,9 +1,8 @@ import logger from '@/lib/logger'; import { appDataDir } from '@tauri-apps/api/path'; +import { platform } from '@tauri-apps/plugin-os'; import { createStore as createTauriStore } from '@tauri-apps/plugin-store'; -const { platform } = window.__TAURI__.os; - // Generic function to create get/set operations const createStoreItem = (store: Awaited>, key: string, defaultValue: T) => ({ get: async () => { @@ -36,7 +35,7 @@ const isFirstRun = (store: Awaited>) => ({ }); const createStore = async (name: string) => { - const currentPlatform = await platform(); + const currentPlatform = platform(); const path = await appDataDir(); const storePath = currentPlatform === "windows" ? `${path}\\${name}` : `${path}/${name}`; const store = await createTauriStore(storePath); diff --git a/src/providers/platform.provider.tsx b/src/providers/platform.provider.tsx index f9325a46..851d77b5 100644 --- a/src/providers/platform.provider.tsx +++ b/src/providers/platform.provider.tsx @@ -6,9 +6,7 @@ import useIsFirstRun from '@/hooks/useIsFirstRun'; import { streams } from '@/lib'; import store from '@/lib/store'; import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; -import { Platform } from '@tauri-apps/plugin-os'; - -const { platform: obtainPlatform } = window.__TAURI__.os; +import { Platform, platform } from '@tauri-apps/plugin-os'; interface PlatformProviderProps { children: React.ReactNode; @@ -48,7 +46,7 @@ const PlatformProvider: React.FC = ({ children }) => { useEffectAsync(async () => { const appStore = await store; - const p = obtainPlatform(); + const p = platform(); setPlatform(p); console.log("Platform: ", p); diff --git a/yarn.lock b/yarn.lock index a7e9e10f..146e631d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3252,7 +3252,7 @@ __metadata: languageName: node linkType: hard -"@tauri-apps/plugin-os@npm:~2.0.0": +"@tauri-apps/plugin-os@npm:~2": version: 2.0.0 resolution: "@tauri-apps/plugin-os@npm:2.0.0" dependencies: @@ -6886,7 +6886,7 @@ __metadata: "@tauri-apps/plugin-autostart": ~2 "@tauri-apps/plugin-fs": ^2.0.0 "@tauri-apps/plugin-log": ~2 - "@tauri-apps/plugin-os": ~2.0.0 + "@tauri-apps/plugin-os": ~2 "@tauri-apps/plugin-process": ^2.0.0 "@tauri-apps/plugin-shell": ^2.0.0 "@tauri-apps/plugin-store": ~2