You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Mobile: Implement plugin screen redesign (#10465)
This commit is contained in:
@ -3,18 +3,20 @@ import { _ } from '@joplin/lib/locale';
|
||||
import PluginService, { PluginSettings, SerializedPluginSettings, defaultPluginSetting } from '@joplin/lib/services/plugins/PluginService';
|
||||
import * as React from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Button } from 'react-native-paper';
|
||||
import pickDocument from '../../../../utils/pickDocument';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
import { Platform } from 'react-native';
|
||||
import { Platform, View, ViewStyle } from 'react-native';
|
||||
import { join, extname } from 'path';
|
||||
import uuid from '@joplin/lib/uuid';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
import TextButton, { ButtonType } from '../../../buttons/TextButton';
|
||||
import { ConfigScreenStyles } from '../configScreenStyles';
|
||||
|
||||
interface Props {
|
||||
updatePluginStates: (settingValue: PluginSettings)=> void;
|
||||
pluginSettings: SerializedPluginSettings;
|
||||
styles: ConfigScreenStyles;
|
||||
}
|
||||
|
||||
const logger = Logger.create('PluginUploadButton');
|
||||
@ -26,6 +28,8 @@ export const canInstallPluginsFromFile = () => {
|
||||
return shim.mobilePlatform() !== 'ios' || Setting.value('env') === 'dev';
|
||||
};
|
||||
|
||||
const buttonStyle: ViewStyle = { flexGrow: 1 };
|
||||
|
||||
const PluginUploadButton: React.FC<Props> = props => {
|
||||
const [showLoadingAnimation, setShowLoadingAnimation] = useState(false);
|
||||
|
||||
@ -85,13 +89,17 @@ const PluginUploadButton: React.FC<Props> = props => {
|
||||
}, [props.pluginSettings, props.updatePluginStates]);
|
||||
|
||||
return (
|
||||
<Button
|
||||
onPress={onInstallFromFile}
|
||||
disabled={showLoadingAnimation || !canInstallPluginsFromFile()}
|
||||
loading={showLoadingAnimation}
|
||||
>
|
||||
{buttonLabel()}
|
||||
</Button>
|
||||
<View style={props.styles.getContainerStyle(false)}>
|
||||
<TextButton
|
||||
type={ButtonType.Primary}
|
||||
onPress={onInstallFromFile}
|
||||
style={buttonStyle}
|
||||
disabled={showLoadingAnimation || !canInstallPluginsFromFile()}
|
||||
loading={showLoadingAnimation}
|
||||
>
|
||||
{buttonLabel()}
|
||||
</TextButton>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user