Chore: Move services and methods away from rocketchat folder (#4033)

* move services to lib

* move methods to lib

* fix imports
This commit is contained in:
Gleidson Daniel Silva 2022-04-07 13:53:07 -03:00 committed by GitHub
parent 13a2962fa2
commit e525392713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 163 additions and 163 deletions

View File

@ -1,4 +1,4 @@
import sdk from '../../../lib/rocketchat/services/sdk'; import sdk from '../../../lib/services/sdk';
import { IUser } from '../../../definitions'; import { IUser } from '../../../definitions';
import EventEmitter from '../../../utils/events'; import EventEmitter from '../../../utils/events';
import subscribeInquiry from './subscriptions/inquiry'; import subscribeInquiry from './subscriptions/inquiry';

View File

@ -2,7 +2,7 @@ import log from '../../../../utils/log';
import { store } from '../../../../lib/store/auxStore'; import { store } from '../../../../lib/store/auxStore';
import RocketChat from '../../../../lib/rocketchat'; import RocketChat from '../../../../lib/rocketchat';
import { inquiryQueueAdd, inquiryQueueRemove, inquiryQueueUpdate, inquiryRequest } from '../../actions/inquiry'; import { inquiryQueueAdd, inquiryQueueRemove, inquiryQueueUpdate, inquiryRequest } from '../../actions/inquiry';
import sdk from '../../../../lib/rocketchat/services/sdk'; import sdk from '../../../../lib/services/sdk';
import { IOmnichannelRoom } from '../../../../definitions'; import { IOmnichannelRoom } from '../../../../definitions';
interface IArgsQueueOmnichannel extends IOmnichannelRoom { interface IArgsQueueOmnichannel extends IOmnichannelRoom {

View File

@ -4,7 +4,7 @@ import EventEmitter from '../../utils/events';
import fetch from '../../utils/fetch'; import fetch from '../../utils/fetch';
import random from '../../utils/random'; import random from '../../utils/random';
import Navigation from '../navigation/appNavigation'; import Navigation from '../navigation/appNavigation';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
const triggersId = new Map(); const triggersId = new Map();

View File

@ -1,7 +1,7 @@
import { ISubscription } from '../../../definitions'; import { ISubscription } from '../../definitions';
import { events, logEvent } from '../../../utils/log'; import { events, logEvent } from '../../utils/log';
import { store } from '../../store/auxStore'; import { store } from '../store/auxStore';
import Navigation from '../../navigation/appNavigation'; import Navigation from '../navigation/appNavigation';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
async function jitsiURL({ room }: { room: ISubscription }) { async function jitsiURL({ room }: { room: ISubscription }) {

View File

@ -2,7 +2,7 @@ import { ERoomTypes } from '../../definitions';
import { store } from '../store/auxStore'; import { store } from '../store/auxStore';
import database from '../database'; import database from '../database';
import RocketChat from '../rocketchat'; import RocketChat from '../rocketchat';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
const restTypes = { const restTypes = {
channel: 'channels', channel: 'channels',

View File

@ -1,9 +1,9 @@
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import database from '../../database'; import database from '../database';
import log from '../../../utils/log'; import log from '../../utils/log';
import { clearEnterpriseModules, setEnterpriseModules as setEnterpriseModulesAction } from '../../../actions/enterpriseModules'; import { clearEnterpriseModules, setEnterpriseModules as setEnterpriseModulesAction } from '../../actions/enterpriseModules';
import { compareServerVersion } from '../../methods/helpers/compareServerVersion'; import { compareServerVersion } from './helpers/compareServerVersion';
const LICENSE_OMNICHANNEL_MOBILE_ENTERPRISE = 'omnichannel-mobile-enterprise'; const LICENSE_OMNICHANNEL_MOBILE_ENTERPRISE = 'omnichannel-mobile-enterprise';
const LICENSE_LIVECHAT_ENTERPRISE = 'livechat-enterprise'; const LICENSE_LIVECHAT_ENTERPRISE = 'livechat-enterprise';

View File

@ -1,14 +1,14 @@
import orderBy from 'lodash/orderBy'; import orderBy from 'lodash/orderBy';
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import { ICustomEmojis } from '../../../reducers/customEmojis'; import { ICustomEmojis } from '../../reducers/customEmojis';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import database from '../../database'; import database from '../database';
import log from '../../../utils/log'; import log from '../../utils/log';
import { setCustomEmojis as setCustomEmojisAction } from '../../../actions/customEmojis'; import { setCustomEmojis as setCustomEmojisAction } from '../../actions/customEmojis';
import { ICustomEmoji, TCustomEmojiModel } from '../../../definitions'; import { ICustomEmoji, TCustomEmojiModel } from '../../definitions';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import { compareServerVersion } from '../../methods/helpers/compareServerVersion'; import { compareServerVersion } from './helpers/compareServerVersion';
interface IUpdateEmojis { interface IUpdateEmojis {
update: TCustomEmojiModel[]; update: TCustomEmojiModel[];

View File

@ -1,8 +1,8 @@
import log from '../../../utils/log'; import log from '../../utils/log';
import { TMessageModel, TSubscriptionModel } from '../../../definitions'; import { TMessageModel, TSubscriptionModel } from '../../definitions';
import { store } from '../../store/auxStore'; import { store } from '../store/auxStore';
import getRoom from '../../methods/getRoom';
import { isGroupChat } from './helpers'; import { isGroupChat } from './helpers';
import getRoom from './getRoom';
type TRoomType = 'p' | 'c' | 'd'; type TRoomType = 'p' | 'c' | 'd';

View File

@ -2,14 +2,14 @@ import { Q } from '@nozbe/watermelondb';
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import orderBy from 'lodash/orderBy'; import orderBy from 'lodash/orderBy';
import { setPermissions as setPermissionsAction } from '../../../actions/permissions'; import { setPermissions as setPermissionsAction } from '../../actions/permissions';
import { IPermission, TPermissionModel } from '../../../definitions'; import { IPermission, TPermissionModel } from '../../definitions';
import log from '../../../utils/log'; import log from '../../utils/log';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import database from '../../database'; import database from '../database';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import protectedFunction from '../../methods/helpers/protectedFunction'; import protectedFunction from './helpers/protectedFunction';
import { compareServerVersion } from '../../methods/helpers/compareServerVersion'; import { compareServerVersion } from './helpers/compareServerVersion';
export const SUPPORTED_PERMISSIONS = [ export const SUPPORTED_PERMISSIONS = [
'add-user-to-any-c-room', 'add-user-to-any-c-room',

View File

@ -1,14 +1,14 @@
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import Model from '@nozbe/watermelondb/Model'; import Model from '@nozbe/watermelondb/Model';
import database from '../../database'; import database from '../database';
import { getRoleById } from '../../database/services/Role'; import { getRoleById } from '../database/services/Role';
import log from '../../../utils/log'; import log from '../../utils/log';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import { removeRoles, setRoles as setRolesAction, updateRoles } from '../../../actions/roles'; import { removeRoles, setRoles as setRolesAction, updateRoles } from '../../actions/roles';
import protectedFunction from '../../methods/helpers/protectedFunction'; import { TRoleModel } from '../../definitions';
import { TRoleModel } from '../../../definitions';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import protectedFunction from './helpers/protectedFunction';
export async function setRoles(): Promise<void> { export async function setRoles(): Promise<void> {
const db = database.active; const db = database.active;

View File

@ -1,4 +1,4 @@
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
export default function (updatedSince: Date) { export default function (updatedSince: Date) {
// subscriptions.get: Since RC 0.60.0 // subscriptions.get: Since RC 0.60.0

View File

@ -1,16 +1,16 @@
import { Q } from '@nozbe/watermelondb'; import { Q } from '@nozbe/watermelondb';
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import { addSettings, clearSettings } from '../../../actions/settings'; import { addSettings, clearSettings } from '../../actions/settings';
import { DEFAULT_AUTO_LOCK, defaultSettings } from '../../constants'; import { DEFAULT_AUTO_LOCK, defaultSettings } from '../constants';
import { IPreparedSettings, ISettingsIcon } from '../../../definitions'; import { IPreparedSettings, ISettingsIcon } from '../../definitions';
import fetch from '../../../utils/fetch'; import fetch from '../../utils/fetch';
import log from '../../../utils/log'; import log from '../../utils/log';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import database from '../../database'; import database from '../database';
import RocketChat from '..';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import protectedFunction from '../../methods/helpers/protectedFunction'; import { parseSettings, _prepareSettings } from './helpers';
import protectedFunction from './helpers/protectedFunction';
const serverInfoKeys = [ const serverInfoKeys = [
'Site_Name', 'Site_Name',
@ -112,7 +112,7 @@ export async function getLoginSettings({ server }: { server: string }): Promise<
if (result.success && result.settings.length) { if (result.success && result.settings.length) {
reduxStore.dispatch(clearSettings()); reduxStore.dispatch(clearSettings());
reduxStore.dispatch(addSettings(RocketChat.parseSettings(RocketChat._prepareSettings(result.settings)))); reduxStore.dispatch(addSettings(parseSettings(_prepareSettings(result.settings))));
} }
} catch (e) { } catch (e) {
log(e); log(e);
@ -131,7 +131,7 @@ export async function setSettings(): Promise<void> {
valueAsArray: item.valueAsArray, valueAsArray: item.valueAsArray,
_updatedAt: item._updatedAt _updatedAt: item._updatedAt
})); }));
reduxStore.dispatch(addSettings(RocketChat.parseSettings(parsed.slice(0, parsed.length)))); reduxStore.dispatch(addSettings(parseSettings(parsed.slice(0, parsed.length))));
} }
export function subscribeSettings(): void { export function subscribeSettings(): void {
@ -155,10 +155,10 @@ export async function getSettings(): Promise<void> {
return; return;
} }
const data: IData[] = result.settings || []; const data: IData[] = result.settings || [];
const filteredSettings: IPreparedSettings[] = RocketChat._prepareSettings(data); const filteredSettings: IPreparedSettings[] = _prepareSettings(data);
const filteredSettingsIds = filteredSettings.map(s => s._id); const filteredSettingsIds = filteredSettings.map(s => s._id);
reduxStore.dispatch(addSettings(RocketChat.parseSettings(filteredSettings))); reduxStore.dispatch(addSettings(parseSettings(filteredSettings)));
// filter server info // filter server info
const serverInfo = filteredSettings.filter(i1 => serverInfoKeys.includes(i1._id)); const serverInfo = filteredSettings.filter(i1 => serverInfoKeys.includes(i1._id));

View File

@ -4,7 +4,7 @@ import database from '../database';
import log from '../../utils/log'; import log from '../../utils/log';
import protectedFunction from './helpers/protectedFunction'; import protectedFunction from './helpers/protectedFunction';
import { ISlashCommandResult, TSlashCommandModel } from '../../definitions'; import { ISlashCommandResult, TSlashCommandModel } from '../../definitions';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
export default function getSlashCommands() { export default function getSlashCommands() {
const db = database.active; const db = database.active;

View File

@ -1,14 +1,14 @@
import { InteractionManager } from 'react-native'; import { InteractionManager } from 'react-native';
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import { IActiveUsers } from '../../../reducers/activeUsers'; import { IActiveUsers } from '../../reducers/activeUsers';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import { setActiveUsers } from '../../../actions/activeUsers'; import { setActiveUsers } from '../../actions/activeUsers';
import { setUser } from '../../../actions/login'; import { setUser } from '../../actions/login';
import database from '../../database'; import database from '../database';
import { IRocketChat, IUser } from '../../../definitions'; import { IRocketChat, IUser } from '../../definitions';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import { compareServerVersion } from '../../methods/helpers/compareServerVersion'; import { compareServerVersion } from './helpers/compareServerVersion';
export function subscribeUsersPresence(this: IRocketChat) { export function subscribeUsersPresence(this: IRocketChat) {
const serverVersion = reduxStore.getState().server.version as string; const serverVersion = reduxStore.getState().server.version as string;

View File

@ -1,11 +1,11 @@
// @ts-nocheck - TEMP // @ts-nocheck - TEMP
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import log from '../../../utils/log'; import log from '../../utils/log';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import database from '../../database'; import database from '../database';
import subscribeRoomsTmp from '../../methods/subscriptions/rooms'; import subscribeRoomsTmp from './subscriptions/rooms';
import { ANALYTICS_EVENTS_KEY, CRASH_REPORT_KEY, defaultSettings } from '../../constants'; import { ANALYTICS_EVENTS_KEY, CRASH_REPORT_KEY, defaultSettings } from '../constants';
export function isGroupChat(room): boolean { export function isGroupChat(room): boolean {
return ((room.uids && room.uids.length > 2) || (room.usernames && room.usernames.length > 2)) ?? false; return ((room.uids && room.uids.length > 2) || (room.usernames && room.usernames.length > 2)) ?? false;

View File

@ -5,7 +5,7 @@ import { IMessage, TMessageModel } from '../../definitions';
import log from '../../utils/log'; import log from '../../utils/log';
import { getMessageById } from '../database/services/Message'; import { getMessageById } from '../database/services/Message';
import roomTypeToApiType, { RoomTypes } from './roomTypeToApiType'; import roomTypeToApiType, { RoomTypes } from './roomTypeToApiType';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
import updateMessages from './updateMessages'; import updateMessages from './updateMessages';
import { generateLoadMoreId } from './helpers/generateLoadMoreId'; import { generateLoadMoreId } from './helpers/generateLoadMoreId';

View File

@ -1,7 +1,7 @@
import { ILastMessage } from '../../definitions'; import { ILastMessage } from '../../definitions';
import log from '../../utils/log'; import log from '../../utils/log';
import database from '../database'; import database from '../database';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
import updateMessages from './updateMessages'; import updateMessages from './updateMessages';
const getLastUpdate = async (rid: string) => { const getLastUpdate = async (rid: string) => {

View File

@ -7,7 +7,7 @@ import { getMessageById } from '../database/services/Message';
import { MessageTypeLoad } from '../constants'; import { MessageTypeLoad } from '../constants';
import updateMessages from './updateMessages'; import updateMessages from './updateMessages';
import { TMessageModel } from '../../definitions'; import { TMessageModel } from '../../definitions';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
import { generateLoadMoreId } from './helpers/generateLoadMoreId'; import { generateLoadMoreId } from './helpers/generateLoadMoreId';
const COUNT = 50; const COUNT = 50;

View File

@ -5,7 +5,7 @@ import orderBy from 'lodash/orderBy';
import log from '../../utils/log'; import log from '../../utils/log';
import { getMessageById } from '../database/services/Message'; import { getMessageById } from '../database/services/Message';
import { MessageTypeLoad } from '../constants'; import { MessageTypeLoad } from '../constants';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
import { IMessage } from '../../definitions'; import { IMessage } from '../../definitions';
import updateMessages from './updateMessages'; import updateMessages from './updateMessages';
import { generateLoadMoreId } from './helpers/generateLoadMoreId'; import { generateLoadMoreId } from './helpers/generateLoadMoreId';

View File

@ -8,7 +8,7 @@ import { Encryption } from '../encryption';
import protectedFunction from './helpers/protectedFunction'; import protectedFunction from './helpers/protectedFunction';
import buildMessage from './helpers/buildMessage'; import buildMessage from './helpers/buildMessage';
import { TThreadMessageModel } from '../../definitions'; import { TThreadMessageModel } from '../../definitions';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
async function load({ tmid }: { tmid: string }) { async function load({ tmid }: { tmid: string }) {
try { try {

View File

@ -2,17 +2,17 @@ import * as FileSystem from 'expo-file-system';
import { Rocketchat as RocketchatClient } from '@rocket.chat/sdk'; import { Rocketchat as RocketchatClient } from '@rocket.chat/sdk';
import Model from '@nozbe/watermelondb/Model'; import Model from '@nozbe/watermelondb/Model';
import { getDeviceToken } from '../../../notifications/push'; import { getDeviceToken } from '../../notifications/push';
import { extractHostname } from '../../../utils/server'; import { extractHostname } from '../../utils/server';
import { BASIC_AUTH_KEY } from '../../../utils/fetch'; import { BASIC_AUTH_KEY } from '../../utils/fetch';
import database, { getDatabase } from '../../database'; import database, { getDatabase } from '../database';
import RocketChat from '..'; import { useSsl } from '../../utils/url';
import { useSsl } from '../../../utils/url'; import log from '../../utils/log';
import log from '../../../utils/log'; import { ICertificate, IRocketChat } from '../../definitions';
import UserPreferences from '../../methods/userPreferences';
import { ICertificate, IRocketChat } from '../../../definitions';
import sdk from '../services/sdk'; import sdk from '../services/sdk';
import { E2E_PRIVATE_KEY, E2E_PUBLIC_KEY, E2E_RANDOM_PASSWORD_KEY } from '../../constants'; import { E2E_PRIVATE_KEY, E2E_PUBLIC_KEY, E2E_RANDOM_PASSWORD_KEY } from '../constants';
import UserPreferences from './userPreferences';
import RocketChat from '../rocketchat';
function removeServerKeys({ server, userId }: { server: string; userId?: string | null }) { function removeServerKeys({ server, userId }: { server: string; userId?: string | null }) {
UserPreferences.removeItem(`${RocketChat.TOKEN_KEY}-${server}`); UserPreferences.removeItem(`${RocketChat.TOKEN_KEY}-${server}`);

View File

@ -1,7 +1,7 @@
import database from '../database'; import database from '../database';
import log from '../../utils/log'; import log from '../../utils/log';
import { TSubscriptionModel } from '../../definitions'; import { TSubscriptionModel } from '../../definitions';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
export default async function readMessages(rid: string, ls: Date, updateLastOpen = false): Promise<void> { export default async function readMessages(rid: string, ls: Date, updateLastOpen = false): Promise<void> {
try { try {

View File

@ -1,9 +1,9 @@
import { Q } from '@nozbe/watermelondb'; import { Q } from '@nozbe/watermelondb';
import { sanitizeLikeString } from '../../database/utils'; import { sanitizeLikeString } from '../database/utils';
import database from '../../database/index'; import database from '../database/index';
import { spotlight } from '../services/restApi'; import { spotlight } from '../services/restApi';
import { ISearch, ISearchLocal, SubscriptionType } from '../../../definitions'; import { ISearch, ISearchLocal, SubscriptionType } from '../../definitions';
import { isGroupChat } from './helpers'; import { isGroupChat } from './helpers';
let debounce: null | ((reason: string) => void) = null; let debounce: null | ((reason: string) => void) = null;

View File

@ -3,11 +3,11 @@ import { settings as RocketChatSettings } from '@rocket.chat/sdk';
import { FetchBlobResponse, StatefulPromise } from 'rn-fetch-blob'; import { FetchBlobResponse, StatefulPromise } from 'rn-fetch-blob';
import isEmpty from 'lodash/isEmpty'; import isEmpty from 'lodash/isEmpty';
import FileUpload from '../../../utils/fileUpload'; import FileUpload from '../../utils/fileUpload';
import database from '../../database'; import database from '../database';
import log from '../../../utils/log'; import log from '../../utils/log';
import { IUpload, IUser, TUploadModel } from '../../../definitions'; import { IUpload, IUser, TUploadModel } from '../../definitions';
import { IFileUpload } from '../../../utils/fileUpload/interfaces'; import { IFileUpload } from '../../utils/fileUpload/interfaces';
const uploadQueue: { [index: string]: StatefulPromise<FetchBlobResponse> } = {}; const uploadQueue: { [index: string]: StatefulPromise<FetchBlobResponse> } = {};

View File

@ -6,7 +6,7 @@ import log from '../../utils/log';
import random from '../../utils/random'; import random from '../../utils/random';
import { Encryption } from '../encryption'; import { Encryption } from '../encryption';
import { E2EType, IMessage, IUser, TMessageModel } from '../../definitions'; import { E2EType, IMessage, IUser, TMessageModel } from '../../definitions';
import sdk from '../rocketchat/services/sdk'; import sdk from '../services/sdk';
import { E2E_MESSAGE_TYPE, E2E_STATUS, messagesStatus } from '../constants'; import { E2E_MESSAGE_TYPE, E2E_STATUS, messagesStatus } from '../constants';
const changeMessageStatus = async (id: string, status: number, tmid?: string, message?: IMessage) => { const changeMessageStatus = async (id: string, status: number, tmid?: string, message?: IMessage) => {

View File

@ -1,9 +1,9 @@
import { InteractionManager } from 'react-native'; import { InteractionManager } from 'react-native';
import { setActiveUsers } from '../../../actions/activeUsers'; import { setActiveUsers } from '../../actions/activeUsers';
import { setUser } from '../../../actions/login'; import { setUser } from '../../actions/login';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import { compareServerVersion } from '../../methods/helpers/compareServerVersion'; import { compareServerVersion } from './helpers/compareServerVersion';
// TODO // TODO
export function _setUser(this: any, ddpMessage: { fields: any; id: any; cleared: any }) { export function _setUser(this: any, ddpMessage: { fields: any; id: any; cleared: any }) {

View File

@ -17,7 +17,7 @@ import { subscribeRoom, unsubscribeRoom } from '../../../actions/room';
import { Encryption } from '../../encryption'; import { Encryption } from '../../encryption';
import { IMessage, TMessageModel, TSubscriptionModel, TThreadMessageModel, TThreadModel } from '../../../definitions'; import { IMessage, TMessageModel, TSubscriptionModel, TThreadMessageModel, TThreadModel } from '../../../definitions';
import { IDDPMessage } from '../../../definitions/IDDPMessage'; import { IDDPMessage } from '../../../definitions/IDDPMessage';
import sdk from '../../rocketchat/services/sdk'; import sdk from '../../services/sdk';
const WINDOW_TIME = 1000; const WINDOW_TIME = 1000;

View File

@ -28,7 +28,7 @@ import {
TThreadMessageModel, TThreadMessageModel,
TThreadModel TThreadModel
} from '../../../definitions'; } from '../../../definitions';
import sdk from '../../rocketchat/services/sdk'; import sdk from '../../services/sdk';
import { IDDPMessage } from '../../../definitions/IDDPMessage'; import { IDDPMessage } from '../../../definitions/IDDPMessage';
import { getSubscriptionByRoomId } from '../../database/services/Subscription'; import { getSubscriptionByRoomId } from '../../database/services/Subscription';
import { getMessageById } from '../../database/services/Message'; import { getMessageById } from '../../database/services/Message';

View File

@ -4,10 +4,10 @@ import {
ITriggerCancel, ITriggerCancel,
ITriggerSubmitView, ITriggerSubmitView,
ModalActions ModalActions
} from '../../../containers/UIKit/interfaces'; } from '../../containers/UIKit/interfaces';
import { TRocketChat } from '../../../definitions'; import { TRocketChat } from '../../definitions';
import { triggerAction } from '../../methods/actions'; import Navigation from '../navigation/appNavigation';
import Navigation from '../../navigation/appNavigation'; import { triggerAction } from './actions';
export function triggerBlockAction(this: TRocketChat, options: ITriggerBlockAction) { export function triggerBlockAction(this: TRocketChat, options: ITriggerBlockAction) {
return triggerAction.call(this, { type: ActionTypes.ACTION, ...options }); return triggerAction.call(this, { type: ActionTypes.ACTION, ...options });

View File

@ -1,5 +1,5 @@
import { IPreferences } from '../../../definitions'; import { IPreferences } from '../../definitions';
import userPreferences from '../../methods/userPreferences'; import userPreferences from './userPreferences';
const SORT_PREFS_KEY = 'RC_SORT_PREFS_KEY'; const SORT_PREFS_KEY = 'RC_SORT_PREFS_KEY';

View File

@ -1,18 +1,18 @@
// Methods // Methods
import canOpenRoom from '../methods/canOpenRoom'; import canOpenRoom from './methods/canOpenRoom';
import clearCache from '../methods/clearCache'; import clearCache from './methods/clearCache';
import getRoom from '../methods/getRoom'; import getRoom from './methods/getRoom';
import getRooms from '../methods/getRooms'; import getRooms from './methods/getRooms';
import getSlashCommands from '../methods/getSlashCommands'; import getSlashCommands from './methods/getSlashCommands';
import loadMessagesForRoom from '../methods/loadMessagesForRoom'; import loadMessagesForRoom from './methods/loadMessagesForRoom';
import loadMissedMessages from '../methods/loadMissedMessages'; import loadMissedMessages from './methods/loadMissedMessages';
import loadNextMessages from '../methods/loadNextMessages'; import loadNextMessages from './methods/loadNextMessages';
import loadSurroundingMessages from '../methods/loadSurroundingMessages'; import loadSurroundingMessages from './methods/loadSurroundingMessages';
import loadThreadMessages from '../methods/loadThreadMessages'; import loadThreadMessages from './methods/loadThreadMessages';
import readMessages from '../methods/readMessages'; import readMessages from './methods/readMessages';
import roomTypeToApiType from '../methods/roomTypeToApiType'; import roomTypeToApiType from './methods/roomTypeToApiType';
// Spread Methods // Spread Methods
import * as sendMessage from '../methods/sendMessage'; import * as sendMessage from './methods/sendMessage';
import * as callJitsi from './methods/callJitsi'; import * as callJitsi from './methods/callJitsi';
import * as enterpriseModules from './methods/enterpriseModules'; import * as enterpriseModules from './methods/enterpriseModules';
import * as getCustomEmojis from './methods/getCustomEmojis'; import * as getCustomEmojis from './methods/getCustomEmojis';

View File

@ -4,26 +4,26 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import { InteractionManager } from 'react-native'; import { InteractionManager } from 'react-native';
import { Q } from '@nozbe/watermelondb'; import { Q } from '@nozbe/watermelondb';
import log from '../../../utils/log'; import log from '../../utils/log';
import { onRolesChanged } from '../methods/getRoles'; import { setActiveUsers } from '../../actions/activeUsers';
import { setActiveUsers } from '../../../actions/activeUsers'; import protectedFunction from '../methods/helpers/protectedFunction';
import protectedFunction from '../../methods/helpers/protectedFunction'; import database from '../database';
import database from '../../database'; import { selectServerFailure } from '../../actions/server';
import { selectServerFailure } from '../../../actions/server'; import { twoFactor } from '../../utils/twoFactor';
import { twoFactor } from '../../../utils/twoFactor'; import { store } from '../store/auxStore';
import { store } from '../../store/auxStore'; import { loginRequest, setLoginServices, setUser } from '../../actions/login';
import { loginRequest, setLoginServices, setUser } from '../../../actions/login';
import sdk from './sdk'; import sdk from './sdk';
import I18n from '../../../i18n'; import I18n from '../../i18n';
import RocketChat from '..'; import RocketChat from '../rocketchat';
import { ICredentials, ILoggedUser, IRocketChat, STATUSES } from '../../../definitions'; import { ICredentials, ILoggedUser, IRocketChat, STATUSES } from '../../definitions';
import { isIOS } from '../../../utils/deviceInfo'; import { isIOS } from '../../utils/deviceInfo';
import { connectRequest, connectSuccess, disconnect as disconnectAction } from '../../../actions/connect'; import { connectRequest, connectSuccess, disconnect as disconnectAction } from '../../actions/connect';
import { updatePermission } from '../../../actions/permissions'; import { updatePermission } from '../../actions/permissions';
import EventEmitter from '../../../utils/events'; import EventEmitter from '../../utils/events';
import { updateSettings } from '../../../actions/settings'; import { updateSettings } from '../../actions/settings';
import { defaultSettings, MIN_ROCKETCHAT_VERSION } from '../../constants'; import { defaultSettings, MIN_ROCKETCHAT_VERSION } from '../constants';
import { compareServerVersion } from '../../methods/helpers/compareServerVersion'; import { compareServerVersion } from '../methods/helpers/compareServerVersion';
import { onRolesChanged } from '../methods/getRoles';
interface IServices { interface IServices {
[index: string]: string | boolean; [index: string]: string | boolean;

View File

@ -7,18 +7,18 @@ import {
SubscriptionType, SubscriptionType,
IUser, IUser,
TRocketChat TRocketChat
} from '../../../definitions'; } from '../../definitions';
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces'; import { IAvatarSuggestion, IParams } from '../../definitions/IProfileViewInterfaces';
import { ISpotlight } from '../../../definitions/ISpotlight'; import { ISpotlight } from '../../definitions/ISpotlight';
import { TEAM_TYPE } from '../../../definitions/ITeam'; import { TEAM_TYPE } from '../../definitions/ITeam';
import { Encryption } from '../../encryption'; import { Encryption } from '../encryption';
import { TParams } from '../../../definitions/ILivechatEditView'; import { TParams } from '../../definitions/ILivechatEditView';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import { getDeviceToken } from '../../../notifications/push'; import { getDeviceToken } from '../../notifications/push';
import { getBundleId, isIOS } from '../../../utils/deviceInfo'; import { getBundleId, isIOS } from '../../utils/deviceInfo';
import roomTypeToApiType, { RoomTypes } from '../../methods/roomTypeToApiType'; import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
import sdk from './sdk'; import sdk from './sdk';
import { compareServerVersion } from '../../methods/helpers/compareServerVersion'; import { compareServerVersion } from '../methods/helpers/compareServerVersion';
export const createChannel = ({ export const createChannel = ({
name, name,

View File

@ -2,10 +2,10 @@ import { Rocketchat } from '@rocket.chat/sdk';
import EJSON from 'ejson'; import EJSON from 'ejson';
import isEmpty from 'lodash/isEmpty'; import isEmpty from 'lodash/isEmpty';
import { twoFactor } from '../../../utils/twoFactor'; import { twoFactor } from '../../utils/twoFactor';
import { useSsl } from '../../../utils/url'; import { useSsl } from '../../utils/url';
import { store as reduxStore } from '../../store/auxStore'; import { store as reduxStore } from '../store/auxStore';
import { Serialized, MatchPathPattern, OperationParams, PathFor, ResultFor } from '../../../definitions/rest/helpers'; import { Serialized, MatchPathPattern, OperationParams, PathFor, ResultFor } from '../../definitions/rest/helpers';
class Sdk { class Sdk {
private sdk: typeof Rocketchat; private sdk: typeof Rocketchat;

View File

@ -1,14 +1,14 @@
import { Q } from '@nozbe/watermelondb'; import { Q } from '@nozbe/watermelondb';
import { shareSetSettings, shareSelectServer, shareSetUser } from '../../../actions/share'; import { shareSetSettings, shareSelectServer, shareSetUser } from '../../actions/share';
import SSLPinning from '../../../utils/sslPinning'; import SSLPinning from '../../utils/sslPinning';
import log from '../../../utils/log'; import log from '../../utils/log';
import { IShareServer, IShareUser } from '../../../reducers/share'; import { IShareServer, IShareUser } from '../../reducers/share';
import UserPreferences from '../../methods/userPreferences'; import UserPreferences from '../methods/userPreferences';
import database from '../../database'; import database from '../database';
import RocketChat from '..'; import RocketChat from '../rocketchat';
import { encryptionInit } from '../../../actions/encryption'; import { encryptionInit } from '../../actions/encryption';
import { store } from '../../store/auxStore'; import { store } from '../store/auxStore';
import sdk from './sdk'; import sdk from './sdk';
export async function shareExtensionInit(server: string) { export async function shareExtensionInit(server: string) {

View File

@ -1,6 +1,6 @@
import { PERMISSIONS } from '../actions/actionsTypes'; import { PERMISSIONS } from '../actions/actionsTypes';
import { TActionPermissions } from '../actions/permissions'; import { TActionPermissions } from '../actions/permissions';
import { SUPPORTED_PERMISSIONS } from '../lib/rocketchat/methods/getPermissions'; import { SUPPORTED_PERMISSIONS } from '../lib/methods/getPermissions';
export type TSupportedPermissions = typeof SUPPORTED_PERMISSIONS[number]; export type TSupportedPermissions = typeof SUPPORTED_PERMISSIONS[number];

View File

@ -20,7 +20,7 @@ import UserPreferences from '../lib/methods/userPreferences';
import { inquiryRequest, inquiryReset } from '../ee/omnichannel/actions/inquiry'; import { inquiryRequest, inquiryReset } from '../ee/omnichannel/actions/inquiry';
import { isOmnichannelStatusAvailable } from '../ee/omnichannel/lib'; import { isOmnichannelStatusAvailable } from '../ee/omnichannel/lib';
import { RootEnum } from '../definitions'; import { RootEnum } from '../definitions';
import sdk from '../lib/rocketchat/services/sdk'; import sdk from '../lib/services/sdk';
const getServer = state => state.server.server; const getServer = state => state.server.server;
const loginWithPasswordCall = args => RocketChat.loginWithPassword(args); const loginWithPasswordCall = args => RocketChat.loginWithPassword(args);

View File

@ -10,7 +10,7 @@ import UserPreferences from './lib/methods/userPreferences';
import Navigation from './lib/navigation/shareNavigation'; import Navigation from './lib/navigation/shareNavigation';
import store from './lib/store'; import store from './lib/store';
import { initStore } from './lib/store/auxStore'; import { initStore } from './lib/store/auxStore';
import { closeShareExtension, shareExtensionInit } from './lib/rocketchat/services/shareExtension'; import { closeShareExtension, shareExtensionInit } from './lib/services/shareExtension';
import { defaultHeader, getActiveRouteName, navigationTheme, themedHeader } from './utils/navigation'; import { defaultHeader, getActiveRouteName, navigationTheme, themedHeader } from './utils/navigation';
import RocketChat from './lib/rocketchat'; import RocketChat from './lib/rocketchat';
import { ThemeContext, TSupportedThemes } from './theme'; import { ThemeContext, TSupportedThemes } from './theme';

View File

@ -7,7 +7,7 @@ import moment from 'moment';
import UserPreferences from '../lib/methods/userPreferences'; import UserPreferences from '../lib/methods/userPreferences';
import { store } from '../lib/store/auxStore'; import { store } from '../lib/store/auxStore';
import database from '../lib/database'; import database from '../lib/database';
import { getServerTimeSync } from '../lib/rocketchat/services/getServerTimeSync'; import { getServerTimeSync } from '../lib/services/getServerTimeSync';
import { import {
ATTEMPTS_KEY, ATTEMPTS_KEY,
BIOMETRY_ENABLED_KEY, BIOMETRY_ENABLED_KEY,

View File

@ -7,7 +7,7 @@ import { Q, Model } from '@nozbe/watermelondb';
import I18n from '../i18n'; import I18n from '../i18n';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
import ServerItem, { ROW_HEIGHT } from '../presentation/ServerItem'; import ServerItem, { ROW_HEIGHT } from '../presentation/ServerItem';
import { shareExtensionInit } from '../lib/rocketchat/services/shareExtension'; import { shareExtensionInit } from '../lib/services/shareExtension';
import database from '../lib/database'; import database from '../lib/database';
import SafeAreaView from '../containers/SafeAreaView'; import SafeAreaView from '../containers/SafeAreaView';
import * as List from '../containers/List'; import * as List from '../containers/List';