1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Mobile: Support copying app information (#10336)

This commit is contained in:
Henry Heino 2024-04-25 05:53:46 -07:00 committed by GitHub
parent 4e95486c5c
commit 34b265475d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 38 additions and 10 deletions

View File

@ -666,6 +666,7 @@ packages/app-mobile/utils/fs-driver/tarExtract.test.js
packages/app-mobile/utils/fs-driver/tarExtract.js
packages/app-mobile/utils/fs-driver/testUtil/createFilesFromPathRecord.js
packages/app-mobile/utils/fs-driver/testUtil/verifyDirectoryMatches.js
packages/app-mobile/utils/getPackageInfo.js
packages/app-mobile/utils/initializeCommandService.js
packages/app-mobile/utils/ipc/RNToWebViewMessenger.js
packages/app-mobile/utils/ipc/WebViewToRNMessenger.js

1
.gitignore vendored
View File

@ -646,6 +646,7 @@ packages/app-mobile/utils/fs-driver/tarExtract.test.js
packages/app-mobile/utils/fs-driver/tarExtract.js
packages/app-mobile/utils/fs-driver/testUtil/createFilesFromPathRecord.js
packages/app-mobile/utils/fs-driver/testUtil/verifyDirectoryMatches.js
packages/app-mobile/utils/getPackageInfo.js
packages/app-mobile/utils/initializeCommandService.js
packages/app-mobile/utils/ipc/RNToWebViewMessenger.js
packages/app-mobile/utils/ipc/WebViewToRNMessenger.js

View File

@ -8,7 +8,6 @@ import setIgnoreTlsErrors from '../../../utils/TlsUtils';
import { reg } from '@joplin/lib/registry';
import { State } from '@joplin/lib/reducer';
const { BackButtonService } = require('../../../services/back-button.js');
const VersionInfo = require('react-native-version-info').default;
import { connect } from 'react-redux';
import ScreenHeader from '../../ScreenHeader';
import { _ } from '@joplin/lib/locale';
@ -33,6 +32,8 @@ import PluginStates, { getSearchText as getPluginStatesSearchText } from './plug
import PluginUploadButton, { canInstallPluginsFromFile, buttonLabel as pluginUploadButtonSearchText } from './plugins/PluginUploadButton';
import NoteImportButton, { importButtonDefaultTitle, importButtonDescription } from './NoteExportSection/NoteImportButton';
import SectionDescription from './SectionDescription';
import getPackageInfo from '../../../utils/getPackageInfo';
import versionInfo from '@joplin/lib/versionInfo';
interface ConfigScreenState {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
@ -602,13 +603,20 @@ class ConfigScreenComponent extends BaseScreenComponent<ConfigScreenProps, Confi
addSettingLink('website_link', _('Joplin website'), 'https://joplinapp.org/');
addSettingLink('privacy_link', _('Privacy Policy'), 'https://joplinapp.org/privacy/');
addSettingText('version_info_app', `Joplin ${VersionInfo.appVersion}`);
addSettingText('version_info_db', _('Database v%s', reg.db().version()));
addSettingText('version_info_sync', _('Sync Version: %s', Setting.value('syncVersion')));
addSettingText('version_info_client_id', _('Client ID: %s', Setting.value('clientId')));
addSettingText('version_info_fts', _('FTS enabled: %d', this.props.settings['db.ftsEnabled']));
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
addSettingText('version_info_hermes', _('Hermes enabled: %d', (global as any).HermesInternal ? 1 : 0));
const packageInfo = getPackageInfo();
const appInfo = versionInfo(packageInfo, PluginService.instance().enabledPlugins(settings['plugins.states']));
const versionInfoText = [
appInfo.body,
'',
_('FTS enabled: %d', this.props.settings['db.ftsEnabled']),
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
_('Hermes enabled: %d', (global as any).HermesInternal ? 1 : 0),
].join('\n');
addSettingText('version_info', versionInfoText);
addSettingButton('copy_app_info', _('Copy version info'), () => {
Clipboard.setString(versionInfoText);
});
const featureFlagKeys = Setting.featureFlagKeys(AppType.Mobile);
if (featureFlagKeys.length) {

View File

@ -0,0 +1,17 @@
import shim from '@joplin/lib/shim';
import { PackageInfo } from '@joplin/lib/versionInfo';
import ReactNativeVersionInfo from 'react-native-version-info';
const getPackageInfo = (): PackageInfo => {
const version = shim.appVersion();
return {
description: 'Joplin for Mobile',
name: 'Joplin',
version,
build: {
appId: ReactNativeVersionInfo.bundleIdentifier,
},
};
};
export default getPackageInfo;

View File

@ -2,6 +2,7 @@ import { _ } from './locale';
import Setting from './models/Setting';
import { reg } from './registry';
import { Plugins } from './services/plugins/PluginService';
import shim from './shim';
export interface PackageInfo {
name: string;
@ -10,7 +11,7 @@ export interface PackageInfo {
build: {
appId: string;
};
git: {
git?: {
branch: string;
hash: string;
};
@ -70,7 +71,7 @@ export default function versionInfo(packageInfo: PackageInfo, plugins: Plugins)
];
const body = [
_('%s %s (%s, %s)', p.name, p.version, Setting.value('env'), process.platform),
_('%s %s (%s, %s)', p.name, p.version, Setting.value('env'), shim.platformName()),
'',
_('Client ID: %s', Setting.value('clientId')),
_('Sync Version: %s', Setting.value('syncVersion')),