Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: updating the check for updates mechanism with support for arm64 arch

Ilian Sapundshiev29ff66c40629
diff --git a/assets/links.ts b/assets/links.ts
index 04fc8bef8..6761f1e9c 100644
--- a/assets/links.ts
+++ b/assets/links.ts
@@ -57,6 +57,9 @@ const Links = {
twitter: 'https://x.com/tagspaces',
mastodon: 'https://fosstodon.org/@tagspaces',
playStoreRedeem: 'https://play.google.com/redeem',
+ appStoreApp: 'https://apps.apple.com/app/id6779178134',
+ playStoreApp:
+ 'https://play.google.com/store/apps/details?id=org.tagspaces.mobileapp',
emailContact: 'mailto:[email protected]?subject=App',
cancelSubscription:
'mailto:[email protected]?subject=Cancel%20subscription&body=Please%20enter%20here%20you%20order%20ID%20or%20the%20email%20with%20which%20the%20purchase%20was%20made.', // 'https://fastspring.com/consumer-support-form/?ulCase.Primary_Category__c=Cancel%20/%20Refund&Case.Category__c=Cancel%20Subscription'
diff --git a/src/main/preload.ts b/src/main/preload.ts
index 48dabecae..1d87866a3 100644
--- a/src/main/preload.ts
+++ b/src/main/preload.ts
@@ -124,6 +124,10 @@ const electronHandler = {
return webUtils.getPathForFile(file);
},
},
+ // CPU architecture of the running Electron binary ('arm64' | 'x64' | …).
+ // process isn't available in the sandboxed renderer, so surface it here
+ // for arch-specific logic like picking the update descriptor file.
+ arch: process.arch,
};
contextBridge.exposeInMainWorld('electronIO', electronHandler);
diff --git a/src/renderer/components/dialogs/AboutDialog.tsx b/src/renderer/components/dialogs/AboutDialog.tsx
index 692af5475..47b086e2a 100644
--- a/src/renderer/components/dialogs/AboutDialog.tsx
+++ b/src/renderer/components/dialogs/AboutDialog.tsx
@@ -74,7 +74,15 @@ function AboutDialog(props: Props) {
function checkForUpdates() {
if (updateAvailable) {
- openURLExternally(Links.links.downloadURL, true);
+ // On mobile the app is updated through the store, so route there
+ // instead of the desktop downloads page.
+ if (AppConfig.isCapacitoriOS || AppConfig.isCordovaiOS) {
+ openURLExternally(Links.links.appStoreApp, true);
+ } else if (AppConfig.isCapacitorAndroid || AppConfig.isCordovaAndroid) {
+ openURLExternally(Links.links.playStoreApp, true);
+ } else {
+ openURLExternally(Links.links.downloadURL, true);
+ }
} else {
getLastVersionPromise()
.then((lastVersion) => {
diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.ts
index b2ef9b3f4..efa33e58f 100644
--- a/src/renderer/services/utils-io.ts
+++ b/src/renderer/services/utils-io.ts
@@ -472,14 +472,36 @@ export function getLastVersionPromise(signal?: AbortSignal): Promise<string> {
let versionFile = 'tagspaces.json';
const proText = Pro ? 'pro-' : '';
+ // Desktop architecture suffix. process.arch isn't reachable in the
+ // sandboxed renderer, so the preload bridge exposes it as
+ // window.electronIO.arch ('arm64' | 'x64' | …). Apple Silicon / Windows
+ // on ARM / ARM Linux get the -arm64 descriptor; everything else keeps
+ // the existing x64 (and bare 'mac') names.
+ const isArm64 =
+ typeof window !== 'undefined' &&
+ (window as any).electronIO?.arch === 'arm64';
+ // Native mobile must be matched BEFORE the desktop OS branches: the iOS
+ // WebView UA matches isMacLike (iPhone/iPad) and the Android WebView UA
+ // contains "Linux", so leaving them last makes iOS resolve to the macOS
+ // descriptor and Android to the Linux one (the isAndroid branch was dead).
if (AppConfig.isWeb) {
versionFile = 'tagspaces-pro-web.json';
+ } else if (AppConfig.isCapacitoriOS || AppConfig.isCordovaiOS) {
+ versionFile = 'tagspaces-' + proText + 'ios.json';
+ } else if (AppConfig.isCapacitorAndroid || AppConfig.isCordovaAndroid) {
+ versionFile = 'tagspaces-' + proText + 'android.json';
} else if (AppConfig.isWin) {
- versionFile = 'tagspaces-' + proText + 'win-x64.json';
+ versionFile =
+ 'tagspaces-' + proText + (isArm64 ? 'win-arm64' : 'win-x64') + '.json';
} else if (AppConfig.isMacLike) {
- versionFile = 'tagspaces-' + proText + 'mac.json';
+ versionFile =
+ 'tagspaces-' + proText + (isArm64 ? 'mac-arm64' : 'mac') + '.json';
} else if (AppConfig.isLinux) {
- versionFile = 'tagspaces-' + proText + 'linux-x64.json';
+ versionFile =
+ 'tagspaces-' +
+ proText +
+ (isArm64 ? 'linux-arm64' : 'linux-x64') +
+ '.json';
} else if (AppConfig.isAndroid) {
versionFile = 'tagspaces-' + proText + 'android.json';
}