mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Android: Fixes #7691: Sharing file to Joplin does not work
This commit is contained in:
parent
02e8307093
commit
a1a10a6c55
@ -9,6 +9,7 @@ import { _ } from '@joplin/lib/locale';
|
||||
interface Props {
|
||||
themeId: number;
|
||||
sensorInfo: SensorInfo;
|
||||
dispatch: Function;
|
||||
}
|
||||
|
||||
export default (props: Props) => {
|
||||
@ -49,6 +50,11 @@ export default (props: Props) => {
|
||||
} else {
|
||||
setTryBiometricsCheck(true);
|
||||
}
|
||||
|
||||
props.dispatch({
|
||||
type: 'BIOMETRICS_DONE_SET',
|
||||
value: true,
|
||||
});
|
||||
};
|
||||
|
||||
Alert.alert(
|
||||
@ -67,7 +73,7 @@ export default (props: Props) => {
|
||||
},
|
||||
]
|
||||
);
|
||||
}, [initialPromptDone, props.sensorInfo.supportedSensors, display]);
|
||||
}, [initialPromptDone, props.sensorInfo.supportedSensors, display, props.dispatch]);
|
||||
|
||||
const windowSize = useMemo(() => {
|
||||
return {
|
||||
@ -76,6 +82,15 @@ export default (props: Props) => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!display) {
|
||||
props.dispatch({
|
||||
type: 'BIOMETRICS_DONE_SET',
|
||||
value: true,
|
||||
});
|
||||
}
|
||||
}, [display, props.dispatch]);
|
||||
|
||||
const renderTryAgainButton = () => {
|
||||
if (!display || tryBiometricsCheck || !initialPromptDone) return null;
|
||||
return <Button title={_('Try again')} onPress={() => setTryBiometricsCheck(true)} />;
|
||||
|
@ -727,7 +727,10 @@ class AppComponent extends React.Component {
|
||||
};
|
||||
|
||||
this.handleOpenURL_ = (event: any) => {
|
||||
if (event.url === ShareExtension.shareURL) {
|
||||
// If this is called while biometrics haven't been done yet, we can
|
||||
// ignore the call, because handleShareData() will be called once
|
||||
// biometricsDone is `true`.
|
||||
if (event.url === ShareExtension.shareURL && this.props.biometricsDone) {
|
||||
void this.handleShareData();
|
||||
}
|
||||
};
|
||||
@ -812,8 +815,6 @@ class AppComponent extends React.Component {
|
||||
this.appStateChangeListener_ = RNAppState.addEventListener('change', this.onAppStateChange_);
|
||||
this.unsubscribeScreenWidthChangeHandler_ = Dimensions.addEventListener('change', this.handleScreenWidthChange_);
|
||||
|
||||
await this.handleShareData();
|
||||
|
||||
setupQuickActions(this.props.dispatch, this.props.selectedFolderId);
|
||||
|
||||
await setupNotifications(this.props.dispatch);
|
||||
@ -848,6 +849,10 @@ class AppComponent extends React.Component {
|
||||
duration: 600,
|
||||
}).start();
|
||||
}
|
||||
|
||||
if (this.props.biometricsDone !== prevProps.biometricsDone && this.props.biometricsDone) {
|
||||
void this.handleShareData();
|
||||
}
|
||||
}
|
||||
|
||||
private async backButtonHandler() {
|
||||
@ -973,10 +978,11 @@ class AppComponent extends React.Component {
|
||||
</View>
|
||||
<DropdownAlert ref={(ref: any) => this.dropdownAlert_ = ref} tapToCloseEnabled={true} />
|
||||
<Animated.View pointerEvents='none' style={{ position: 'absolute', backgroundColor: 'black', opacity: this.state.sideMenuContentOpacity, width: '100%', height: '120%' }}/>
|
||||
<BiometricPopup
|
||||
{ this.state.sensorInfo && <BiometricPopup
|
||||
dispatch={this.props.dispatch}
|
||||
themeId={this.props.themeId}
|
||||
sensorInfo={this.state.sensorInfo}
|
||||
/>
|
||||
/> }
|
||||
</SafeAreaView>
|
||||
</MenuContext>
|
||||
</SideMenu>
|
||||
@ -1017,6 +1023,7 @@ const mapStateToProps = (state: any) => {
|
||||
routeName: state.route.routeName,
|
||||
themeId: state.settings.theme,
|
||||
noteSideMenuOptions: state.noteSideMenuOptions,
|
||||
biometricsDone: state.biometricsDone,
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -79,6 +79,7 @@ export interface State {
|
||||
settings: any;
|
||||
sharedData: any;
|
||||
appState: string;
|
||||
biometricsDone: boolean;
|
||||
hasDisabledSyncItems: boolean;
|
||||
hasDisabledEncryptionItems: boolean;
|
||||
customCss: string;
|
||||
@ -134,6 +135,7 @@ export const defaultState: State = {
|
||||
settings: {},
|
||||
sharedData: null,
|
||||
appState: 'starting',
|
||||
biometricsDone: false,
|
||||
hasDisabledSyncItems: false,
|
||||
hasDisabledEncryptionItems: false,
|
||||
customCss: '',
|
||||
@ -1086,6 +1088,10 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
draft.appState = action.state;
|
||||
break;
|
||||
|
||||
case 'BIOMETRICS_DONE_SET':
|
||||
draft.biometricsDone = action.value;
|
||||
break;
|
||||
|
||||
case 'SYNC_HAS_DISABLED_SYNC_ITEMS':
|
||||
draft.hasDisabledSyncItems = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user