mattermost-mobile/share_extension/android/extension.js
Elias Nahum 7c09334dc4
Deps update (#3806)
* Dependecy updates

* Update dependencies
2020-01-20 13:20:03 -03:00

56 lines
1.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {PureComponent} from 'react';
import {Alert, NativeModules} from 'react-native';
import {intlShape} from 'react-intl';
import {captureException, initializeSentry, LOGGER_EXTENSION} from 'app/utils/sentry';
import Navigation from './navigation';
const ShareExtension = NativeModules.MattermostShare;
export default class ShareApp extends PureComponent {
static contextTypes = {
intl: intlShape,
};
constructor(props) {
super(props);
initializeSentry();
}
componentDidCatch(error) {
const {intl, store} = this.context;
const {formatMessage} = intl;
captureException(error, LOGGER_EXTENSION, store);
Alert.alert(
formatMessage({
id: 'mobile.share_extension.error_title',
defaultMessage: 'Extension Error',
}),
formatMessage({
id: 'mobile.share_extension.error_message',
defaultMessage: 'An error has occurred while using the share extension.',
}),
[
{
text: formatMessage({
id: 'mobile.share_extension.error_close',
defaultMessage: 'Close',
}),
onPress: this.close,
},
],
);
}
close = () => ShareExtension.close(null)
render() {
return <Navigation/>;
}
}