From 5446c0f30537f7facf4d09062a2fba9512840d17 Mon Sep 17 00:00:00 2001 From: linonetwo Date: Fri, 29 Dec 2023 23:09:57 +0800 Subject: [PATCH] refactor: rename nativeService.open -> openURI --- src/components/Sidebar.tsx | 2 +- src/pages/About.tsx | 12 ++++++------ src/pages/EditWorkspace/server.tsx | 2 +- src/pages/Help/HelpWebsiteItem.tsx | 2 +- src/pages/Preferences/sections/DeveloperTools.tsx | 6 +++--- src/pages/Preferences/sections/FriendLinks.tsx | 6 +++--- src/pages/Preferences/sections/LanguageModel.tsx | 2 +- src/pages/Preferences/sections/Miscellaneous.tsx | 4 ++-- src/pages/Preferences/sections/Notifications.tsx | 4 ++-- .../Preferences/sections/PrivacyAndSecurity.tsx | 6 +++--- src/pages/Preferences/sections/Updates.tsx | 2 +- src/pages/WikiBackground/ErrorMessage.tsx | 6 +++--- src/services/native/index.ts | 2 +- src/services/native/interface.ts | 12 ++++++------ src/services/native/reportError.ts | 2 +- src/services/workspaces/getWorkspaceMenuTemplate.ts | 6 +++--- 16 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 5376f41a..c9cf4ac2 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -134,7 +134,7 @@ export function SideBar(): JSX.Element { id='update-available' aria-label={t('SideBar.UpdateAvailable')} onClick={async () => { - await window.service.native.open(updaterMetaData.info?.latestReleasePageUrl ?? latestStableUpdateUrl); + await window.service.native.openURI(updaterMetaData.info?.latestReleasePageUrl ?? latestStableUpdateUrl); }} > {t('SideBar.UpdateAvailable')}} placement='top'> diff --git a/src/pages/About.tsx b/src/pages/About.tsx index f8eaf1b9..caf362b6 100644 --- a/src/pages/About.tsx +++ b/src/pages/About.tsx @@ -99,14 +99,14 @@ export default function About(): JSX.Element { { - await window.service.native.open('https://github.com/tiddly-gittly/TidGi-Desktop'); + await window.service.native.openURI('https://github.com/tiddly-gittly/TidGi-Desktop'); }} > Website { - await window.service.native.open('https://github.com/tiddly-gittly/TidGi-Desktop/issues/new/choose'); + await window.service.native.openURI('https://github.com/tiddly-gittly/TidGi-Desktop/issues/new/choose'); }} > Support @@ -123,13 +123,13 @@ export default function About(): JSX.Element { { - await window.service.native.open('https://onetwo.ren/wiki/'); + await window.service.native.openURI('https://onetwo.ren/wiki/'); }} onKeyDown={async (event: React.KeyboardEvent) => { if (event.key !== 'Enter') { return; } - await window.service.native.open('https://onetwo.ren/wiki/'); + await window.service.native.openURI('https://onetwo.ren/wiki/'); }} role='link' tabIndex={0} @@ -139,13 +139,13 @@ export default function About(): JSX.Element { && { - await window.service.native.open('https://webcatalog.app/?utm_source=tidgi_app'); + await window.service.native.openURI('https://webcatalog.app/?utm_source=tidgi_app'); }} onKeyDown={async (event: React.KeyboardEvent) => { if (event.key !== 'Enter') { return; } - await window.service.native.open('https://webcatalog.app/?utm_source=tidgi_app'); + await window.service.native.openURI('https://webcatalog.app/?utm_source=tidgi_app'); }} role='link' tabIndex={0} diff --git a/src/pages/EditWorkspace/server.tsx b/src/pages/EditWorkspace/server.tsx index e7bcc511..c6afc355 100644 --- a/src/pages/EditWorkspace/server.tsx +++ b/src/pages/EditWorkspace/server.tsx @@ -107,7 +107,7 @@ export function ServerOptions(props: IServerOptionsProps) { {t('EditWorkspace.URL')}{' '} { - actualIP && (await window.service.native.open(actualIP)); + actualIP && (await window.service.native.openURI(actualIP)); }} style={{ cursor: 'pointer' }} > diff --git a/src/pages/Help/HelpWebsiteItem.tsx b/src/pages/Help/HelpWebsiteItem.tsx index 7061cd4e..e5338763 100644 --- a/src/pages/Help/HelpWebsiteItem.tsx +++ b/src/pages/Help/HelpWebsiteItem.tsx @@ -40,7 +40,7 @@ export const HelpWebsiteItem: React.FC = ({ item }) => { void window.service.window.open(WindowNames.any, { uri }, { multiple: true }); }; const openExternalLinkInBrowser = (uri: string) => { - void window.service.native.open(uri); + void window.service.native.openURI(uri); }; return ( diff --git a/src/pages/Preferences/sections/DeveloperTools.tsx b/src/pages/Preferences/sections/DeveloperTools.tsx index c85d3fbc..2ef049e5 100644 --- a/src/pages/Preferences/sections/DeveloperTools.tsx +++ b/src/pages/Preferences/sections/DeveloperTools.tsx @@ -27,7 +27,7 @@ export function DeveloperTools(props: ISectionProps): JSX.Element { button onClick={() => { if (LOG_FOLDER !== undefined) { - void window.service.native.open(LOG_FOLDER, true); + void window.service.native.openPath(LOG_FOLDER, true); } }} > @@ -38,7 +38,7 @@ export function DeveloperTools(props: ISectionProps): JSX.Element { button onClick={() => { if (SETTINGS_FOLDER !== undefined) { - void window.service.native.open(SETTINGS_FOLDER, true); + void window.service.native.openPath(SETTINGS_FOLDER, true); } }} > @@ -50,7 +50,7 @@ export function DeveloperTools(props: ISectionProps): JSX.Element { onClick={async () => { if (V8_CACHE_FOLDER !== undefined) { try { - await window.service.native.open(V8_CACHE_FOLDER, true); + await window.service.native.openPath(V8_CACHE_FOLDER, true); } catch (error) { console.error(error); } diff --git a/src/pages/Preferences/sections/FriendLinks.tsx b/src/pages/Preferences/sections/FriendLinks.tsx index 6d3a383e..631e7c01 100644 --- a/src/pages/Preferences/sections/FriendLinks.tsx +++ b/src/pages/Preferences/sections/FriendLinks.tsx @@ -26,7 +26,7 @@ export function FriendLinks(props: ISectionProps): JSX.Element { { - await window.service.native.open('https://github.com/webcatalog/webcatalog-engine'); + await window.service.native.openURI('https://github.com/webcatalog/webcatalog-engine'); }} > @@ -36,7 +36,7 @@ export function FriendLinks(props: ISectionProps): JSX.Element { { - await window.service.native.open('https://webcatalogapp.com?utm_source=tidgi_app'); + await window.service.native.openURI('https://webcatalogapp.com?utm_source=tidgi_app'); }} > } secondary={t('Preference.WebCatalogIntro')} /> @@ -46,7 +46,7 @@ export function FriendLinks(props: ISectionProps): JSX.Element { { - await window.service.native.open('https://translatiumapp.com?utm_source=tidgi_app'); + await window.service.native.openURI('https://translatiumapp.com?utm_source=tidgi_app'); }} > } secondary={t('Preference.TranslatiumIntro')} /> diff --git a/src/pages/Preferences/sections/LanguageModel.tsx b/src/pages/Preferences/sections/LanguageModel.tsx index 17c5f987..e0e0457d 100644 --- a/src/pages/Preferences/sections/LanguageModel.tsx +++ b/src/pages/Preferences/sections/LanguageModel.tsx @@ -30,7 +30,7 @@ export function LanguageModel(props: Partial): JSX.Element { onClick={async () => { if (LANGUAGE_MODEL_FOLDER !== undefined) { await window.service.native.mkdir(LANGUAGE_MODEL_FOLDER); - await window.service.native.open(LANGUAGE_MODEL_FOLDER, true); + await window.service.native.openPath(LANGUAGE_MODEL_FOLDER, true); } }} > diff --git a/src/pages/Preferences/sections/Miscellaneous.tsx b/src/pages/Preferences/sections/Miscellaneous.tsx index 5a66ec77..dc2f6e1e 100644 --- a/src/pages/Preferences/sections/Miscellaneous.tsx +++ b/src/pages/Preferences/sections/Miscellaneous.tsx @@ -30,7 +30,7 @@ export function Miscellaneous(props: ISectionProps): JSX.Element { { - await window.service.native.open('https://github.com/tiddly-gittly/TidGi-desktop/'); + await window.service.native.openURI('https://github.com/tiddly-gittly/TidGi-desktop/'); }} > @@ -40,7 +40,7 @@ export function Miscellaneous(props: ISectionProps): JSX.Element { { - await window.service.native.open('https://github.com/tiddly-gittly/TidGi-desktop/issues'); + await window.service.native.openURI('https://github.com/tiddly-gittly/TidGi-desktop/issues'); }} > diff --git a/src/pages/Preferences/sections/Notifications.tsx b/src/pages/Preferences/sections/Notifications.tsx index 43b2d10b..90b9b0d1 100644 --- a/src/pages/Preferences/sections/Notifications.tsx +++ b/src/pages/Preferences/sections/Notifications.tsx @@ -153,11 +153,11 @@ export function Notifications(props: Required): JSX.Element { { - await window.service.native.open('https://github.com/atomery/webcatalog/wiki/How-to-Enable-Notifications-in-Web-Apps'); + await window.service.native.openURI('https://github.com/atomery/webcatalog/wiki/How-to-Enable-Notifications-in-Web-Apps'); }} onKeyDown={(event: React.KeyboardEvent) => { if (event.key !== 'Enter') return; - void window.service.native.open('https://github.com/atomery/webcatalog/wiki/How-to-Enable-Notifications-in-Web-Apps'); + void window.service.native.openURI('https://github.com/atomery/webcatalog/wiki/How-to-Enable-Notifications-in-Web-Apps'); }} > Learn more diff --git a/src/pages/Preferences/sections/PrivacyAndSecurity.tsx b/src/pages/Preferences/sections/PrivacyAndSecurity.tsx index 4cc8bda8..750068db 100644 --- a/src/pages/Preferences/sections/PrivacyAndSecurity.tsx +++ b/src/pages/Preferences/sections/PrivacyAndSecurity.tsx @@ -43,11 +43,11 @@ export function PrivacyAndSecurity(props: Required): JSX.Element Not recommended. { - await window.service.native.open('https://groups.google.com/a/chromium.org/d/msg/security-dev/mB2KJv_mMzM/ddMteO9RjXEJ'); + await window.service.native.openURI('https://groups.google.com/a/chromium.org/d/msg/security-dev/mB2KJv_mMzM/ddMteO9RjXEJ'); }} onKeyDown={(event: React.KeyboardEvent) => { if (event.key !== 'Enter') return; - void window.service.native.open('https://groups.google.com/a/chromium.org/d/msg/security-dev/mB2KJv_mMzM/ddMteO9RjXEJ'); + void window.service.native.openURI('https://groups.google.com/a/chromium.org/d/msg/security-dev/mB2KJv_mMzM/ddMteO9RjXEJ'); }} > Learn more @@ -82,7 +82,7 @@ export function PrivacyAndSecurity(props: Required): JSX.Element { - await window.service.native.open('https://github.com/tiddly-gittly/TidGi-Desktop/blob/master/PrivacyPolicy.md'); + await window.service.native.openURI('https://github.com/tiddly-gittly/TidGi-Desktop/blob/master/PrivacyPolicy.md'); }} > diff --git a/src/pages/Preferences/sections/Updates.tsx b/src/pages/Preferences/sections/Updates.tsx index 7b8445d5..728637ac 100644 --- a/src/pages/Preferences/sections/Updates.tsx +++ b/src/pages/Preferences/sections/Updates.tsx @@ -27,7 +27,7 @@ export function Updates(props: Required): JSX.Element { button onClick={updaterMetaData.status === IUpdaterStatus.updateAvailable ? async () => { - await window.service.native.open(updaterMetaData.info?.latestReleasePageUrl ?? latestStableUpdateUrl); + await window.service.native.openURI(updaterMetaData.info?.latestReleasePageUrl ?? latestStableUpdateUrl); } : async () => { await window.service.updater.checkForUpdates(); diff --git a/src/pages/WikiBackground/ErrorMessage.tsx b/src/pages/WikiBackground/ErrorMessage.tsx index 8f3af3e1..8d66bb98 100644 --- a/src/pages/WikiBackground/ErrorMessage.tsx +++ b/src/pages/WikiBackground/ErrorMessage.tsx @@ -49,7 +49,7 @@ export function WikiErrorMessages(props: IWikiErrorMessagesProps): JSX.Element {