1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Desktop: Fixes #11989: Joplin became unusably slow on MacOS due to incorrect detection of architecture

This commit is contained in:
Laurent Cozic
2025-03-21 11:55:53 +01:00
parent 20f7f37b49
commit 2142373fff
5 changed files with 56 additions and 1 deletions

View File

@@ -83,6 +83,7 @@ interface Props {
notesColumns: NoteListColumns;
showInvalidJoplinCloudCredential: boolean;
toast: Toast;
shouldSwitchToAppleSiliconVersion: boolean;
}
interface ShareFolderDialogOptions {
@@ -492,6 +493,11 @@ class MainScreenComponent extends React.Component<Props, State> {
});
};
const onDownloadAppleSiliconVersion = () => {
// The website should redirect to the correct version
shim.openUrl('https://joplinapp.org/download/');
};
const onRestartAndUpgrade = async () => {
Setting.setValue('sync.upgradeState', Setting.SYNC_UPGRADE_STATE_MUST_DO);
await Setting.saveAll();
@@ -574,6 +580,12 @@ class MainScreenComponent extends React.Component<Props, State> {
);
} else if (this.props.mustUpgradeAppMessage) {
msg = this.renderNotificationMessage(this.props.mustUpgradeAppMessage);
} else if (this.props.shouldSwitchToAppleSiliconVersion) {
msg = this.renderNotificationMessage(
_('You are running the Intel version of Joplin on an Apple Silicon processor. Download the Apple Silicon one for better performance.'),
_('Download it now'),
onDownloadAppleSiliconVersion,
);
} else if (this.props.showInvalidJoplinCloudCredential) {
msg = this.renderNotificationMessage(
_('Your Joplin Cloud credentials are invalid, please login.'),
@@ -611,7 +623,8 @@ class MainScreenComponent extends React.Component<Props, State> {
this.showShareInvitationNotification(props) ||
this.props.needApiAuth ||
!!this.props.mustUpgradeAppMessage ||
props.showInvalidJoplinCloudCredential;
props.showInvalidJoplinCloudCredential ||
props.shouldSwitchToAppleSiliconVersion;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
@@ -839,6 +852,7 @@ const mapStateToProps = (state: AppState) => {
notesColumns: validateColumns(state.settings['notes.columns']),
showInvalidJoplinCloudCredential: state.settings['sync.target'] === 10 && state.mustAuthenticate,
toast: state.toast,
shouldSwitchToAppleSiliconVersion: shim.isAppleSilicon() && process.arch !== 'arm64',
};
};

View File

@@ -168,6 +168,14 @@ export default function shimInit() {
return Platform.OS;
};
shim.isAppleSilicon = () => {
return false;
};
shim.platformArch = () => {
return ''; // Not supported
};
shim.appVersion = () => {
const p = require('react-native-version-info').default;
return p.appVersion;

View File

@@ -19,6 +19,7 @@ import FileApiDriverLocal from './file-api-driver-local';
import * as mimeUtils from './mime-utils';
import BaseItem from './models/BaseItem';
import { Size } from '@joplin/utils/types';
import { arch } from 'os';
const { _ } = require('./locale');
const http = require('http');
const https = require('https');
@@ -170,6 +171,14 @@ function shimInit(options: ShimInitOptions = null) {
return Array.from(buffer);
};
shim.isAppleSilicon = () => {
return shim.isMac() && arch() === 'arm64';
};
shim.platformArch = () => {
return arch();
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
shim.detectAndSetLocale = function(Setting: any) {
let locale = shim.isElectron() ? shim.electronBridge().getLocale() : process.env.LANG;

View File

@@ -156,6 +156,12 @@ const shim = {
return typeof process !== 'undefined' && process.platform === 'darwin';
},
// Tells whether the computer **CPU** is an Apple Silicon (not whether the running version was
// built for ARM64)
isAppleSilicon: (): boolean => {
throw new Error('Not implemented: isAppleSilicon');
},
platformName: () => {
if (shim.isReactNative()) return shim.mobilePlatform();
if (shim.isMac()) return 'darwin';
@@ -166,6 +172,23 @@ const shim = {
throw new Error('Cannot determine platform');
},
// Tells the computer CPU architecture. Which if different from the architecture the running
// version was built for. For example, the laptop CPU may be an ARM64, while the version was
// built for x64 architecture. Here we want to know the laptop CPU.
platformArch: (): string => {
throw new Error('Not implemented: platformArch');
},
deviceString: () => {
const output: string[] = [];
output.push(shim.platformName());
if (shim.platformArch()) output.push(shim.platformArch());
return output.join(', ');
},
// "ios" or "android", or "" if not on mobile
mobilePlatform: () => {
return ''; // Default if we're not on mobile (React Native)

View File

@@ -85,6 +85,7 @@ export default function versionInfo(packageInfo: PackageInfo, plugins: Plugins)
const body = [
_('%s %s (%s, %s)', p.name, p.version, Setting.value('env'), shim.platformName()),
'',
_('Device: %s', shim.deviceString()),
_('Client ID: %s', Setting.value('clientId')),
_('Sync Version: %s', Setting.value('syncVersion')),
_('Profile Version: %s', reg.db().version()),