hotfix: fix window cannot be dragged when light traffic widget is shown on macOS (#304)

* fix: fix window cannot be dragged when light traffic widget is shown on macOS

* fix: detecting tauri focus event for deeplink redirect in oauth

* release: version 0.9.9
This commit is contained in:
Huang Xin
2025-02-06 20:54:39 +01:00
committed by GitHub
parent b879184dc6
commit b2ef55832c
5 changed files with 38 additions and 11 deletions
+11 -2
View File
@@ -16,9 +16,10 @@ import { useTheme } from '@/hooks/useTheme';
import { useEnv } from '@/context/EnvContext';
import { useSettingsStore } from '@/store/settingsStore';
import { isTauriAppPlatform } from '@/services/environment';
import { onOpenUrl } from '@tauri-apps/plugin-deep-link';
import { onOpenUrl, getCurrent } from '@tauri-apps/plugin-deep-link';
import { start, cancel, onUrl, onInvalidUrl } from '@fabianlars/tauri-plugin-oauth';
import { openUrl } from '@tauri-apps/plugin-opener';
import { tauriHandleOnWindowFocus } from '@/utils/window';
import { handleAuthCallback } from '@/helpers/auth';
import { getOSPlatform } from '@/utils/misc';
@@ -90,7 +91,15 @@ export default function AuthPage() {
openUrl(data.url);
// FIXME: For Android we need a better way to trigger the deeplink redirect
if (getOSPlatform() === 'android') {
if (isTauriAppPlatform() && osPlatform === 'android') {
tauriHandleOnWindowFocus(async () => {
const urls = await getCurrent();
if (urls && urls.length > 0) {
urls.forEach((url) => {
handleOAuthUrl(url);
});
}
});
setTimeout(() => {
router.back();
}, 5000);
@@ -43,6 +43,8 @@ const LibraryHeader: React.FC<LibraryHeaderProps> = ({
};
}, [onToggleSelectMode]);
const windowButtonVisible = appService?.appPlatform !== 'web' && !isTrafficLightVisible;
return (
<div
ref={headerRef}
@@ -104,14 +106,12 @@ const LibraryHeader: React.FC<LibraryHeaderProps> = ({
>
<SettingsMenu />
</Dropdown>
{!isTrafficLightVisible && appService?.appPlatform !== 'web' && (
<WindowButtons
headerRef={headerRef}
showMinimize={true}
showMaximize={true}
showClose={true}
/>
)}
<WindowButtons
headerRef={headerRef}
showMinimize={windowButtonVisible}
showMaximize={windowButtonVisible}
showClose={windowButtonVisible}
/>
</div>
</div>
</div>
+9
View File
@@ -24,3 +24,12 @@ export const tauriHandleOnCloseWindow = async (callback: () => void) => {
await exit(0);
});
};
export const tauriHandleOnWindowFocus = async (callback: () => void) => {
const { TauriEvent } = await import('@tauri-apps/api/event');
const { getCurrentWindow } = await import('@tauri-apps/api/window');
const currentWindow = getCurrentWindow();
return currentWindow.listen(TauriEvent.WINDOW_FOCUS, async () => {
await callback();
});
};