mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-17 13:52:14 +01:00
Use proper Windows APIs for checking/setting default app (#5000)
# Description of Changes Use proper Windows APIs for checking/setting default app --------- Co-authored-by: Connor Yoh <con.yoh13@gmail.com> Co-authored-by: ConnorYoh <40631091+ConnorYoh@users.noreply.github.com>
This commit is contained in:
@@ -33,11 +33,11 @@ export const useDefaultApp = () => {
|
||||
body: t('defaultApp.success.message', 'Stirling PDF is now your default PDF editor'),
|
||||
});
|
||||
setIsDefault(true);
|
||||
} else if (result === 'opened_settings') {
|
||||
} else if (result === 'opened_dialog') {
|
||||
alert({
|
||||
alertType: 'neutral',
|
||||
title: t('defaultApp.settingsOpened.title', 'Settings Opened'),
|
||||
body: t('defaultApp.settingsOpened.message', 'Please select Stirling PDF in your system settings'),
|
||||
body: t('defaultApp.settingsOpened.message', 'Please select Stirling PDF in the file association dialogue'),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -88,8 +88,7 @@ export function useEndpointEnabled(endpoint: string): {
|
||||
try {
|
||||
setError(null);
|
||||
|
||||
const response = await apiClient.get<boolean>('/api/v1/config/endpoint-enabled', {
|
||||
params: { endpoint },
|
||||
const response = await apiClient.get<boolean>(`/api/v1/config/endpoint-enabled?endpoint=${encodeURIComponent(endpoint)}`, {
|
||||
suppressErrorToast: true,
|
||||
});
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ export const defaultAppService = {
|
||||
* Set or prompt to set Stirling PDF as default PDF handler
|
||||
* Returns a status string indicating what happened
|
||||
*/
|
||||
async setAsDefaultPdfHandler(): Promise<'set_successfully' | 'opened_settings' | 'error'> {
|
||||
async setAsDefaultPdfHandler(): Promise<'set_successfully' | 'opened_dialog' | 'error'> {
|
||||
try {
|
||||
const result = await invoke<string>('set_as_default_pdf_handler');
|
||||
return result as 'set_successfully' | 'opened_settings';
|
||||
return result as 'set_successfully' | 'opened_dialog';
|
||||
} catch (error) {
|
||||
console.error('[DefaultApp] Failed to set default handler:', error);
|
||||
return 'error';
|
||||
|
||||
Reference in New Issue
Block a user