* Add linter rules for import order and type member delimiters * Remove unneeded group * Group all app/* imports before the internal imports * Move app/ imports before parent imports * Separate @node_modules imports into a different group * Substitute app paths by aliases * Fix @node_modules import order and add test related modules * Add aliases for types and test, and group import types
35 lines
1 KiB
TypeScript
35 lines
1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Platform} from 'react-native';
|
|
import createActionBuffer from 'redux-action-buffer';
|
|
import {PERSIST, REHYDRATE} from 'redux-persist';
|
|
import {ThunkMiddleware} from 'redux-thunk';
|
|
|
|
import messageRetention from './message_retention';
|
|
import createSentryMiddleware from './sentry';
|
|
import thunk from './thunk';
|
|
|
|
export function createMiddlewares(clientOptions: any): ThunkMiddleware[] {
|
|
const {
|
|
enableBuffer,
|
|
enableThunk,
|
|
} = clientOptions;
|
|
const middleware: ThunkMiddleware[] = [];
|
|
|
|
if (enableThunk) {
|
|
middleware.push(thunk);
|
|
}
|
|
|
|
middleware.push(createSentryMiddleware(), messageRetention);
|
|
if (Platform.OS === 'ios') {
|
|
const iosExtension = require('./ios_extension').default;
|
|
middleware.push(iosExtension);
|
|
}
|
|
|
|
if (enableBuffer) {
|
|
middleware.push(createActionBuffer({breaker: REHYDRATE, passthrough: [PERSIST]}));
|
|
}
|
|
|
|
return middleware;
|
|
}
|