Chore: Create app/lib/store folder (#4028)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Gleidson Daniel Silva 2022-04-07 11:19:54 -03:00 committed by GitHub
parent bdf83e546e
commit d38c17bcd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 36 additions and 36 deletions

View File

@ -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';

View File

@ -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';

View File

@ -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);

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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

View File

@ -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';

View File

@ -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';

View File

@ -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 {

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 }) => {

View File

@ -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 {