一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
55 行
1.7 KiB
TypeScript
55 行
1.7 KiB
TypeScript
import versionInfo from '@joplin/lib/versionInfo';
|
|
import { Platform, NativeModules } from 'react-native';
|
|
import getPackageInfo from './getPackageInfo';
|
|
import PluginService, { PluginSettings } from '@joplin/lib/services/plugins/PluginService';
|
|
import Setting from '@joplin/lib/models/Setting';
|
|
import { _ } from '@joplin/lib/locale';
|
|
|
|
const getWebViewVersionText = () => {
|
|
if (Platform.OS === 'android') {
|
|
// SystemInformationPackage is unavailable on older versions of Android.
|
|
const constants = NativeModules.SystemInformationPackage?.getConstants();
|
|
return [
|
|
_('WebView version: %s', constants?.webViewVersion ?? _('Unknown')),
|
|
_('WebView package: %s', constants?.webViewPackage ?? _('Unknown')),
|
|
].join('\n');
|
|
}
|
|
return null;
|
|
};
|
|
|
|
const getOSVersion = (): string => {
|
|
if (Platform.OS === 'android') {
|
|
return _('Android API level: %d', Platform.Version);
|
|
} else if (Platform.OS === 'ios') {
|
|
return _('iOS version: %s', Platform.Version);
|
|
} else if (Platform.OS === 'web') {
|
|
return `User agent: ${navigator.userAgent}`;
|
|
} else {
|
|
return _('Unknown platform');
|
|
}
|
|
};
|
|
|
|
const getVersionInfoText = (pluginStates: PluginSettings) => {
|
|
const packageInfo = getPackageInfo();
|
|
const appInfo = versionInfo(packageInfo, PluginService.instance().enabledPlugins(pluginStates));
|
|
const versionInfoLines = [
|
|
appInfo.body,
|
|
'',
|
|
getOSVersion(),
|
|
];
|
|
|
|
const webViewVersion = getWebViewVersionText();
|
|
if (webViewVersion) {
|
|
versionInfoLines.push(webViewVersion);
|
|
}
|
|
|
|
versionInfoLines.push(
|
|
_('FTS enabled: %d', Setting.value('db.ftsEnabled')),
|
|
_('Hermes enabled: %d', (global as { HermesInternal?: unknown }).HermesInternal ? 1 : 0),
|
|
);
|
|
|
|
return versionInfoLines.join('\n');
|
|
};
|
|
|
|
export default getVersionInfoText;
|