* CBA Support * cba support for iOS Share extension * Autologin with credentials * Set initial config for ExperimentalClientSideCertEnable as false * Fix mattermost-redux to cba branch * feedback review * Fix eslint
68 lines
1.6 KiB
JavaScript
68 lines
1.6 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React, {PureComponent} from 'react';
|
|
import {NativeModules} from 'react-native';
|
|
import {IntlProvider} from 'react-intl';
|
|
import DeviceInfo from 'react-native-device-info';
|
|
|
|
import Config from 'assets/config';
|
|
import {getTranslations} from 'app/i18n';
|
|
import 'app/fetch_preconfig';
|
|
|
|
import {captureExceptionWithoutState, initializeSentry, LOGGER_EXTENSION} from 'app/utils/sentry';
|
|
|
|
import ErrorMessage from './error_message';
|
|
import Extension from './extension';
|
|
|
|
const ShareExtension = NativeModules.MattermostShare;
|
|
|
|
export class SharedApp extends PureComponent {
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
initializeSentry();
|
|
|
|
this.state = {
|
|
hasError: false,
|
|
};
|
|
}
|
|
|
|
componentDidCatch(error) {
|
|
this.setState({hasError: true});
|
|
|
|
captureExceptionWithoutState(error, LOGGER_EXTENSION);
|
|
}
|
|
|
|
close = (data) => {
|
|
ShareExtension.close(data, Config.AppGroupId);
|
|
};
|
|
|
|
render() {
|
|
if (this.state.hasError) {
|
|
return (
|
|
<ErrorMessage close={this.close}/>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Extension
|
|
appGroupId={Config.AppGroupId}
|
|
onClose={this.close}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default function ShareExtensionProvider() {
|
|
const locale = DeviceInfo.getDeviceLocale().split('-')[0];
|
|
|
|
return (
|
|
<IntlProvider
|
|
locale={locale}
|
|
messages={getTranslations(locale)}
|
|
>
|
|
<SharedApp/>
|
|
</IntlProvider>
|
|
);
|
|
}
|