Chore: Create app/lib/store folder (#4028)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
bdf83e546e
commit
d38c17bcd8
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { View } from 'react-native';
|
||||
import { KeyboardRegistry } from 'react-native-ui-lib/keyboard';
|
||||
|
||||
import { store } from '../../lib/auxStore';
|
||||
import { store } from '../../lib/store/auxStore';
|
||||
import EmojiPicker from '../EmojiPicker';
|
||||
import styles from './styles';
|
||||
import { themes } from '../../lib/constants';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import log from '../../../../utils/log';
|
||||
import { store } from '../../../../lib/auxStore';
|
||||
import { store } from '../../../../lib/store/auxStore';
|
||||
import RocketChat from '../../../../lib/rocketchat';
|
||||
import { inquiryQueueAdd, inquiryQueueRemove, inquiryQueueUpdate, inquiryRequest } from '../../actions/inquiry';
|
||||
import sdk from '../../../../lib/rocketchat/services/sdk';
|
||||
|
|
|
@ -12,7 +12,6 @@ import { appInit, appInitLocalSettings, setMasterDetail as setMasterDetailAction
|
|||
import { deepLinkingOpen } from './actions/deepLinking';
|
||||
import parseQuery from './lib/methods/helpers/parseQuery';
|
||||
import { initializePushNotifications, onNotification } from './notifications/push';
|
||||
import store from './lib/createStore';
|
||||
import { toggleAnalyticsEventsReport, toggleCrashErrorsReport } from './utils/log';
|
||||
import { ThemeContext, TSupportedThemes } from './theme';
|
||||
import { DimensionsContext } from './dimensions';
|
||||
|
@ -30,7 +29,8 @@ import debounce from './utils/debounce';
|
|||
import { isFDroidBuild, MIN_WIDTH_MASTER_DETAIL_LAYOUT, colors, themes } from './lib/constants';
|
||||
import { IThemePreference } from './definitions/ITheme';
|
||||
import { ICommand } from './definitions/ICommand';
|
||||
import { initStore } from './lib/auxStore';
|
||||
import store from './lib/store';
|
||||
import { initStore } from './lib/store/auxStore';
|
||||
|
||||
RNScreens.enableScreens();
|
||||
initStore(store);
|
||||
|
|
|
@ -9,7 +9,7 @@ import database from '../database';
|
|||
import protectedFunction from '../methods/helpers/protectedFunction';
|
||||
import Deferred from '../../utils/deferred';
|
||||
import log from '../../utils/log';
|
||||
import { store } from '../auxStore';
|
||||
import { store } from '../store/auxStore';
|
||||
import { joinVectorData, randomPassword, splitVectorData, toString, utf8ToBuffer } from './utils';
|
||||
import { EncryptionRoom } from './index';
|
||||
import { IMessage, ISubscription, TMessageModel, TSubscriptionModel, TThreadMessageModel, TThreadModel } from '../../definitions';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ERoomTypes } from '../../definitions';
|
||||
import { store } from '../auxStore';
|
||||
import { store } from '../store/auxStore';
|
||||
import database from '../database';
|
||||
import RocketChat from '../rocketchat';
|
||||
import sdk from '../rocketchat/services/sdk';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import EJSON from 'ejson';
|
||||
|
||||
import { Encryption } from '../../encryption';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import findSubscriptionsRooms from './findSubscriptionsRooms';
|
||||
import normalizeMessage from './normalizeMessage';
|
||||
import { ISubscription, IServerSubscription, IServerRoom, IRoom } from '../../../definitions';
|
||||
|
|
|
@ -9,7 +9,7 @@ import database from '../../database';
|
|||
import { getMessageById } from '../../database/services/Message';
|
||||
import { getThreadById } from '../../database/services/Thread';
|
||||
import { getThreadMessageById } from '../../database/services/ThreadMessage';
|
||||
import reduxStore from '../../createStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import { addUserTyping, clearUserTyping, removeUserTyping } from '../../../actions/usersTyping';
|
||||
import debounce from '../../../utils/debounce';
|
||||
import RocketChat from '../../rocketchat';
|
||||
|
|
|
@ -8,7 +8,7 @@ import { merge } from '../helpers/mergeSubscriptionsRooms';
|
|||
import protectedFunction from '../helpers/protectedFunction';
|
||||
import log from '../../../utils/log';
|
||||
import random from '../../../utils/random';
|
||||
import { store } from '../../auxStore';
|
||||
import { store } from '../../store/auxStore';
|
||||
import { handlePayloadUserInteraction } from '../actions';
|
||||
import buildMessage from '../helpers/buildMessage';
|
||||
import RocketChat from '../../rocketchat';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ISubscription } from '../../../definitions';
|
||||
import { events, logEvent } from '../../../utils/log';
|
||||
import { store } from '../../auxStore';
|
||||
import { store } from '../../store/auxStore';
|
||||
import Navigation from '../../navigation/appNavigation';
|
||||
import sdk from '../services/sdk';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import sdk from '../services/sdk';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import database from '../../database';
|
||||
import log from '../../../utils/log';
|
||||
import { clearEnterpriseModules, setEnterpriseModules as setEnterpriseModulesAction } from '../../../actions/enterpriseModules';
|
||||
|
|
|
@ -2,7 +2,7 @@ import orderBy from 'lodash/orderBy';
|
|||
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
|
||||
|
||||
import { ICustomEmojis } from '../../../reducers/customEmojis';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import database from '../../database';
|
||||
import log from '../../../utils/log';
|
||||
import { setCustomEmojis as setCustomEmojisAction } from '../../../actions/customEmojis';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import log from '../../../utils/log';
|
||||
import { TMessageModel, TSubscriptionModel } from '../../../definitions';
|
||||
import { store } from '../../auxStore';
|
||||
import { store } from '../../store/auxStore';
|
||||
import getRoom from '../../methods/getRoom';
|
||||
import { isGroupChat } from './helpers';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import orderBy from 'lodash/orderBy';
|
|||
import { setPermissions as setPermissionsAction } from '../../../actions/permissions';
|
||||
import { IPermission, TPermissionModel } from '../../../definitions';
|
||||
import log from '../../../utils/log';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import database from '../../database';
|
||||
import sdk from '../services/sdk';
|
||||
import protectedFunction from '../../methods/helpers/protectedFunction';
|
||||
|
|
|
@ -4,7 +4,7 @@ import Model from '@nozbe/watermelondb/Model';
|
|||
import database from '../../database';
|
||||
import { getRoleById } from '../../database/services/Role';
|
||||
import log from '../../../utils/log';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import { removeRoles, setRoles as setRolesAction, updateRoles } from '../../../actions/roles';
|
||||
import protectedFunction from '../../methods/helpers/protectedFunction';
|
||||
import { TRoleModel } from '../../../definitions';
|
||||
|
|
|
@ -6,7 +6,7 @@ import { DEFAULT_AUTO_LOCK, defaultSettings } from '../../constants';
|
|||
import { IPreparedSettings, ISettingsIcon } from '../../../definitions';
|
||||
import fetch from '../../../utils/fetch';
|
||||
import log from '../../../utils/log';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import database from '../../database';
|
||||
import RocketChat from '..';
|
||||
import sdk from '../services/sdk';
|
||||
|
|
|
@ -2,7 +2,7 @@ import { InteractionManager } from 'react-native';
|
|||
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
|
||||
|
||||
import { IActiveUsers } from '../../../reducers/activeUsers';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import { setActiveUsers } from '../../../actions/activeUsers';
|
||||
import { setUser } from '../../../actions/login';
|
||||
import database from '../../database';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
|
||||
import log from '../../../utils/log';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import database from '../../database';
|
||||
import subscribeRoomsTmp from '../../methods/subscriptions/rooms';
|
||||
import { ANALYTICS_EVENTS_KEY, CRASH_REPORT_KEY, defaultSettings } from '../../constants';
|
||||
|
|
|
@ -2,7 +2,7 @@ import { InteractionManager } from 'react-native';
|
|||
|
||||
import { setActiveUsers } from '../../../actions/activeUsers';
|
||||
import { setUser } from '../../../actions/login';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import { compareServerVersion } from '../../methods/helpers/compareServerVersion';
|
||||
|
||||
// TODO
|
||||
|
|
|
@ -11,7 +11,7 @@ import protectedFunction from '../../methods/helpers/protectedFunction';
|
|||
import database from '../../database';
|
||||
import { selectServerFailure } from '../../../actions/server';
|
||||
import { twoFactor } from '../../../utils/twoFactor';
|
||||
import { store } from '../../auxStore';
|
||||
import { store } from '../../store/auxStore';
|
||||
import { loginRequest, setLoginServices, setUser } from '../../../actions/login';
|
||||
import sdk from './sdk';
|
||||
import I18n from '../../../i18n';
|
||||
|
|
|
@ -13,7 +13,7 @@ import { ISpotlight } from '../../../definitions/ISpotlight';
|
|||
import { TEAM_TYPE } from '../../../definitions/ITeam';
|
||||
import { Encryption } from '../../encryption';
|
||||
import { TParams } from '../../../definitions/ILivechatEditView';
|
||||
import { store as reduxStore } from '../../auxStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import { getDeviceToken } from '../../../notifications/push';
|
||||
import { getBundleId, isIOS } from '../../../utils/deviceInfo';
|
||||
import roomTypeToApiType, { RoomTypes } from '../../methods/roomTypeToApiType';
|
||||
|
|
|
@ -4,7 +4,7 @@ import isEmpty from 'lodash/isEmpty';
|
|||
|
||||
import { twoFactor } from '../../../utils/twoFactor';
|
||||
import { useSsl } from '../../../utils/url';
|
||||
import reduxStore from '../../createStore';
|
||||
import { store as reduxStore } from '../../store/auxStore';
|
||||
import { Serialized, MatchPathPattern, OperationParams, PathFor, ResultFor } from '../../../definitions/rest/helpers';
|
||||
|
||||
class Sdk {
|
||||
|
|
|
@ -8,7 +8,7 @@ import UserPreferences from '../../methods/userPreferences';
|
|||
import database from '../../database';
|
||||
import RocketChat from '..';
|
||||
import { encryptionInit } from '../../../actions/encryption';
|
||||
import { store } from '../../auxStore';
|
||||
import { store } from '../../store/auxStore';
|
||||
import sdk from './sdk';
|
||||
|
||||
export async function shareExtensionInit(server: string) {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
// https://github.com/bamlab/redux-enhancer-react-native-appstate
|
||||
import { AppState } from 'react-native';
|
||||
|
||||
import { APP_STATE } from '../actions/actionsTypes';
|
||||
import { APP_STATE } from '../../actions/actionsTypes';
|
||||
|
||||
export default () =>
|
||||
createStore =>
|
||||
(...args) => {
|
||||
(createStore: any) =>
|
||||
(...args: any) => {
|
||||
const store = createStore(...args);
|
||||
|
||||
let currentState = '';
|
||||
|
||||
const handleAppStateChange = nextAppState => {
|
||||
const handleAppStateChange = (nextAppState: any) => {
|
||||
if (nextAppState !== 'inactive') {
|
||||
if (currentState !== nextAppState) {
|
||||
let type;
|
|
@ -1,6 +1,6 @@
|
|||
import { Store } from 'redux';
|
||||
|
||||
import { IApplicationState } from '../definitions';
|
||||
import { IApplicationState } from '../../definitions';
|
||||
|
||||
// https://redux.js.org/faq/code-structure#how-can-i-use-the-redux-store-in-non-component-files
|
||||
export let store: Store<IApplicationState> = null as any;
|
|
@ -1,8 +1,8 @@
|
|||
import { applyMiddleware, compose, createStore } from 'redux';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
|
||||
import reducers from '../reducers';
|
||||
import sagas from '../sagas';
|
||||
import reducers from '../../reducers';
|
||||
import sagas from '../../sagas';
|
||||
import applyAppStateMiddleware from './appStateMiddleware';
|
||||
|
||||
let sagaMiddleware;
|
|
@ -1,6 +1,6 @@
|
|||
import EJSON from 'ejson';
|
||||
|
||||
import { store } from '../../lib/auxStore';
|
||||
import { store } from '../../lib/store/auxStore';
|
||||
import { deepLinkingOpen } from '../../actions/deepLinking';
|
||||
import { isFDroidBuild } from '../../lib/constants';
|
||||
import PushNotification from './push';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// TODO BUMP LIB VERSION
|
||||
import NotificationsIOS, { NotificationAction, NotificationCategory, Notification } from 'react-native-notifications';
|
||||
|
||||
import { store as reduxStore } from '../../lib/auxStore';
|
||||
import { store as reduxStore } from '../../lib/store/auxStore';
|
||||
import I18n from '../../i18n';
|
||||
import { INotification } from '../../definitions/INotification';
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import { Provider } from 'react-redux';
|
|||
import { getTheme, initialTheme, newThemeState, subscribeTheme, unsubscribeTheme } from './utils/theme';
|
||||
import UserPreferences from './lib/methods/userPreferences';
|
||||
import Navigation from './lib/navigation/shareNavigation';
|
||||
import store from './lib/createStore';
|
||||
import { initStore } from './lib/auxStore';
|
||||
import store from './lib/store';
|
||||
import { initStore } from './lib/store/auxStore';
|
||||
import { closeShareExtension, shareExtensionInit } from './lib/rocketchat/services/shareExtension';
|
||||
import { defaultHeader, getActiveRouteName, navigationTheme, themedHeader } from './utils/navigation';
|
||||
import RocketChat from './lib/rocketchat';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import RocketChat from '../lib/rocketchat';
|
||||
import { store as reduxStore } from '../lib/auxStore';
|
||||
import { store as reduxStore } from '../lib/store/auxStore';
|
||||
import { ISubscription } from '../definitions/ISubscription';
|
||||
|
||||
const canPostReadOnly = async ({ rid }: { rid: string }) => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { sha256 } from 'js-sha256';
|
|||
import moment from 'moment';
|
||||
|
||||
import UserPreferences from '../lib/methods/userPreferences';
|
||||
import { store } from '../lib/auxStore';
|
||||
import { store } from '../lib/store/auxStore';
|
||||
import database from '../lib/database';
|
||||
import { getServerTimeSync } from '../lib/rocketchat/services/getServerTimeSync';
|
||||
import {
|
||||
|
|
Loading…
Reference in New Issue