Chore: Evaluate helpers and utils - Typescript (#4146)

This commit is contained in:
Alex Junior 2022-06-06 11:17:51 -03:00 committed by GitHub
parent e212a3c946
commit 614d9afe65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
242 changed files with 528 additions and 520 deletions

View File

@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { SetUsernameStackParamList, StackParamList } from './definitions/navigationTypes';
import Navigation from './lib/navigation/appNavigation';
import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation';
import { defaultHeader, getActiveRouteName, navigationTheme } from './lib/methods/helpers/navigation';
import { RootEnum } from './definitions';
// Stacks
import AuthLoadingView from './views/AuthLoadingView';
@ -15,7 +15,7 @@ import OutsideStack from './stacks/OutsideStack';
import InsideStack from './stacks/InsideStack';
import MasterDetailStack from './stacks/MasterDetailStack';
import { ThemeContext } from './theme';
import { setCurrentScreen } from './utils/log';
import { setCurrentScreen } from './lib/methods/helpers/log';
// SetUsernameStack
const SetUsername = createStackNavigator<SetUsernameStackParamList>();

View File

@ -8,7 +8,7 @@ import BottomSheet, { BottomSheetBackdrop } from '@gorhom/bottom-sheet';
import { useDimensions, useOrientation } from '../../dimensions';
import { useTheme } from '../../theme';
import { isIOS, isTablet } from '../../utils/deviceInfo';
import { isIOS, isTablet } from '../../lib/methods/helpers';
import { Handle } from './Handle';
import { TActionSheetOptions } from './Provider';
import BottomSheetContent from './BottomSheetContent';

View File

@ -1,8 +1,8 @@
import React from 'react';
import { TouchableOpacity } from 'react-native';
import { isAndroid } from '../../utils/deviceInfo';
import Touch from '../../utils/touch';
import { isAndroid } from '../../lib/methods/helpers';
import Touch from '../../lib/methods/helpers/touch';
// Taken from https://github.com/rgommezz/react-native-scroll-bottom-sheet#touchables
export const Button: typeof React.Component = isAndroid ? Touch : TouchableOpacity;

View File

@ -3,7 +3,7 @@ import { StyleSheet, Text, View } from 'react-native';
import { themes } from '../lib/constants';
import sharedStyles from '../views/Styles';
import { getReadableVersion } from '../utils/deviceInfo';
import { getReadableVersion } from '../lib/methods/helpers';
import I18n from '../i18n';
import { TSupportedThemes } from '../theme';

View File

@ -4,8 +4,8 @@ import FastImage from 'react-native-fast-image';
import Touchable from 'react-native-platform-touchable';
import { settings as RocketChatSettings } from '@rocket.chat/sdk';
import { avatarURL } from '../../utils/avatar';
import { SubscriptionType } from '../../definitions/ISubscription';
import { getAvatarURL } from '../../lib/methods/helpers/getAvatarUrl';
import { SubscriptionType } from '../../definitions';
import Emoji from '../markdown/Emoji';
import { IAvatar } from './interfaces';
import { useTheme } from '../../theme';
@ -58,7 +58,7 @@ const Avatar = React.memo(
} else {
let uri = avatar;
if (!isStatic) {
uri = avatarURL({
uri = getAvatarURL({
type,
text,
size,

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Text, View, ViewStyle } from 'react-native';
import Touch from '../../utils/touch';
import Touch from '../../lib/methods/helpers/touch';
import Avatar from '../Avatar';
import RoomTypeIcon from '../RoomTypeIcon';
import styles, { ROW_HEIGHT } from './styles';

View File

@ -1,10 +1,10 @@
import React from 'react';
import { FlatList, Text, TouchableOpacity } from 'react-native';
import shortnameToUnicode from '../../utils/shortnameToUnicode';
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
import styles from './styles';
import CustomEmoji from './CustomEmoji';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps';
import { IEmoji, IEmojiCategory } from '../../definitions/IEmoji';
const EMOJI_SIZE = 50;

View File

@ -14,8 +14,8 @@ import categories from './categories';
import database from '../../lib/database';
import { emojisByCategory } from './emojis';
import protectedFunction from '../../lib/methods/helpers/protectedFunction';
import shortnameToUnicode from '../../utils/shortnameToUnicode';
import log from '../../utils/log';
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
import log from '../../lib/methods/helpers/log';
import { themes } from '../../lib/constants';
import { TSupportedThemes, withTheme } from '../../theme';
import { IEmoji, TGetCustomEmoji, IApplicationState, ICustomEmojis, TFrequentlyUsedEmojiModel } from '../../definitions';

View File

@ -3,12 +3,12 @@ import { ScrollView, ScrollViewProps, StyleSheet, View } from 'react-native';
import { themes } from '../lib/constants';
import sharedStyles from '../views/Styles';
import scrollPersistTaps from '../utils/scrollPersistTaps';
import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps';
import KeyboardView from './KeyboardView';
import { useTheme } from '../theme';
import StatusBar from './StatusBar';
import AppVersion from './AppVersion';
import { isTablet } from '../utils/deviceInfo';
import { isTablet } from '../lib/methods/helpers';
import SafeAreaView from './SafeAreaView';
interface IFormContainer extends ScrollViewProps {

View File

@ -3,8 +3,8 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import { StyleSheet, View } from 'react-native';
import { themes } from '../../lib/constants';
import { themedHeader } from '../../utils/navigation';
import { isIOS, isTablet } from '../../utils/deviceInfo';
import { themedHeader } from '../../lib/methods/helpers/navigation';
import { isIOS, isTablet } from '../../lib/methods/helpers';
import { useTheme } from '../../theme';
export const headerHeight = isIOS ? 50 : 56;

View File

@ -1,6 +1,6 @@
import React from 'react';
import { isIOS } from '../../utils/deviceInfo';
import { isIOS } from '../../lib/methods/helpers';
import I18n from '../../i18n';
import Container from './HeaderButtonContainer';
import Item from './HeaderButtonItem';

View File

@ -11,7 +11,7 @@ import sharedStyles from '../../views/Styles';
import { themes } from '../../lib/constants';
import { useTheme } from '../../theme';
import { ROW_HEIGHT } from '../RoomItem';
import { goRoom } from '../../utils/goRoom';
import { goRoom } from '../../lib/methods/helpers/goRoom';
import Navigation from '../../lib/navigation/appNavigation';
import { useOrientation } from '../../dimensions';
import { IApplicationState, ISubscription, SubscriptionType } from '../../definitions';

View File

@ -4,9 +4,9 @@ import { connect } from 'react-redux';
import { dequal } from 'dequal';
import NotifierComponent, { INotifierComponent } from './NotifierComponent';
import EventEmitter from '../../utils/events';
import EventEmitter from '../../lib/methods/helpers/events';
import Navigation from '../../lib/navigation/appNavigation';
import { getActiveRoute } from '../../utils/navigation';
import { getActiveRoute } from '../../lib/methods/helpers/navigation';
import { IApplicationState } from '../../definitions';
import { IRoom } from '../../reducers/room';

View File

@ -1,7 +1,7 @@
import React from 'react';
import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from '@codler/react-native-keyboard-aware-scroll-view';
import scrollPersistTaps from '../utils/scrollPersistTaps';
import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps';
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
keyboardVerticalOffset?: number;

View File

@ -2,7 +2,7 @@ import React from 'react';
import { ScrollView, StyleSheet } from 'react-native';
import { withTheme } from '../../theme';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps';
const styles = StyleSheet.create({
container: {

View File

@ -1,7 +1,7 @@
import React from 'react';
import { I18nManager, StyleProp, StyleSheet, Text, TextStyle, View } from 'react-native';
import Touch from '../../utils/touch';
import Touch from '../../lib/methods/helpers/touch';
import { themes } from '../../lib/constants';
import sharedStyles from '../../views/Styles';
import { TSupportedThemes, useTheme } from '../../theme';

View File

@ -10,10 +10,10 @@ import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants';
import Button from './Button';
import OrSeparator from './OrSeparator';
import Touch from '../utils/touch';
import Touch from '../lib/methods/helpers/touch';
import I18n from '../i18n';
import random from '../utils/random';
import { events, logEvent } from '../utils/log';
import { random } from '../lib/methods/helpers';
import { events, logEvent } from '../lib/methods/helpers/log';
import { CustomIcon, TIconsName } from './CustomIcon';
import { IServices } from '../selectors/login';
import { OutsideParamList } from '../stacks/types';

View File

@ -4,7 +4,7 @@ import { FlatList, StyleSheet, Text, View } from 'react-native';
import { TSupportedThemes, useTheme } from '../../theme';
import { themes } from '../../lib/constants';
import { CustomIcon } from '../CustomIcon';
import shortnameToUnicode from '../../utils/shortnameToUnicode';
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
import CustomEmoji from '../EmojiPicker/CustomEmoji';
import database from '../../lib/database';
import { Button } from '../ActionSheet';

View File

@ -6,17 +6,18 @@ import moment from 'moment';
import database from '../../lib/database';
import I18n from '../../i18n';
import log, { logEvent } from '../../utils/log';
import log, { logEvent } from '../../lib/methods/helpers/log';
import Navigation from '../../lib/navigation/appNavigation';
import { getMessageTranslation } from '../message/utils';
import { LISTENER } from '../Toast';
import EventEmitter from '../../utils/events';
import { showConfirmationAlert } from '../../utils/info';
import EventEmitter from '../../lib/methods/helpers/events';
import { showConfirmationAlert } from '../../lib/methods/helpers/info';
import { TActionSheetOptionsItem, useActionSheet } from '../ActionSheet';
import Header, { HEADER_HEIGHT, IHeader } from './Header';
import events from '../../utils/log/events';
import events from '../../lib/methods/helpers/log/events';
import { IApplicationState, ILoggedUser, TAnyMessageModel, TSubscriptionModel } from '../../definitions';
import { getPermalinkMessage, hasPermission } from '../../lib/methods';
import { getPermalinkMessage } from '../../lib/methods';
import { hasPermission } from '../../lib/methods/helpers';
import { Services } from '../../lib/services';
export interface IMessageActionsProps {

View File

@ -2,7 +2,7 @@ import React, { useContext } from 'react';
import { Text } from 'react-native';
import { IEmoji } from '../../../definitions/IEmoji';
import shortnameToUnicode from '../../../utils/shortnameToUnicode';
import shortnameToUnicode from '../../../lib/methods/helpers/shortnameToUnicode';
import CustomEmoji from '../../EmojiPicker/CustomEmoji';
import MessageboxContext from '../Context';
import styles from '../styles';

View File

@ -9,7 +9,7 @@ import styles from './styles';
import I18n from '../../i18n';
import { themes } from '../../lib/constants';
import { CustomIcon } from '../CustomIcon';
import { events, logEvent } from '../../utils/log';
import { events, logEvent } from '../../lib/methods/helpers/log';
import { TSupportedThemes } from '../../theme';
interface IMessageBoxRecordAudioProps {

View File

@ -1,6 +1,6 @@
import { ImageOrVideo } from 'react-native-image-crop-picker';
import { isIOS } from '../../utils/deviceInfo';
import { isIOS } from '../../lib/methods/helpers';
const regex = new RegExp(/\.[^/.]+$/); // Check from last '.' of the string

View File

@ -14,11 +14,10 @@ import { userTyping as userTypingAction } from '../../actions/room';
import styles from './styles';
import database from '../../lib/database';
import { emojis } from '../EmojiPicker/emojis';
import log, { events, logEvent } from '../../utils/log';
import log, { events, logEvent } from '../../lib/methods/helpers/log';
import RecordAudio from './RecordAudio';
import I18n from '../../i18n';
import ReplyPreview from './ReplyPreview';
import debounce from '../../utils/debounce';
import { themes } from '../../lib/constants';
// @ts-ignore
// eslint-disable-next-line import/extensions,import/no-unresolved
@ -26,9 +25,8 @@ import LeftButtons from './LeftButtons';
// @ts-ignore
// eslint-disable-next-line import/extensions,import/no-unresolved
import RightButtons from './RightButtons';
import { isAndroid, isTablet } from '../../utils/deviceInfo';
import { canUploadFile } from '../../utils/media';
import EventEmiter from '../../utils/events';
import { canUploadFile } from '../../lib/methods/helpers/media';
import EventEmiter from '../../lib/methods/helpers/events';
import { KEY_COMMAND, handleCommandShowUpload, handleCommandSubmit, handleCommandTyping } from '../../commands';
import getMentionRegexp from './getMentionRegexp';
import Mentions from './Mentions';
@ -47,11 +45,11 @@ import Navigation from '../../lib/navigation/appNavigation';
import { withActionSheet } from '../ActionSheet';
import { sanitizeLikeString } from '../../lib/database/utils';
import { CustomIcon } from '../CustomIcon';
import { IMessage } from '../../definitions/IMessage';
import { forceJpgExtension } from './forceJpgExtension';
import { IBaseScreen, IPreviewItem, IUser, TGetCustomEmoji, TSubscriptionModel, TThreadModel } from '../../definitions';
import { IBaseScreen, IPreviewItem, IUser, TGetCustomEmoji, TSubscriptionModel, TThreadModel, IMessage } from '../../definitions';
import { MasterDetailInsideStackParamList } from '../../stacks/MasterDetailStack/types';
import { getPermalinkMessage, hasPermission, search, sendFileMessage } from '../../lib/methods';
import { getPermalinkMessage, search, sendFileMessage } from '../../lib/methods';
import { hasPermission, debounce, isAndroid, isTablet } from '../../lib/methods/helpers';
import { Services } from '../../lib/services';
import { TSupportedThemes } from '../../theme';

View File

@ -1,6 +1,6 @@
import { StyleSheet } from 'react-native';
import { isIOS } from '../../utils/deviceInfo';
import { isIOS } from '../../lib/methods/helpers';
import sharedStyles from '../../views/Styles';
const MENTION_HEIGHT = 50;

View File

@ -5,7 +5,7 @@ import database from '../lib/database';
import protectedFunction from '../lib/methods/helpers/protectedFunction';
import { useActionSheet } from './ActionSheet';
import I18n from '../i18n';
import log from '../utils/log';
import log from '../lib/methods/helpers/log';
import { TMessageModel } from '../definitions';
import { resendMessage } from '../lib/methods';

View File

@ -3,7 +3,7 @@ import { Text } from 'react-native';
import styles from './styles';
import { themes } from '../../../lib/constants';
import Touch from '../../../utils/touch';
import Touch from '../../../lib/methods/helpers/touch';
import { CustomIcon, TIconsName } from '../../CustomIcon';
import { useTheme } from '../../../theme';

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Grid } from 'react-native-easy-grid';
import { themes } from '../../../lib/constants';
import { resetAttempts } from '../../../utils/localAuthentication';
import { resetAttempts } from '../../../lib/methods/helpers/localAuthentication';
import { TYPE } from '../constants';
import { getDiff, getLockedUntil } from '../utils';
import I18n from '../../../i18n';

View File

@ -8,7 +8,7 @@ import Base, { IBase } from './Base';
import Locked from './Base/Locked';
import { TYPE } from './constants';
import { ATTEMPTS_KEY, LOCKED_OUT_TIMER_KEY, MAX_ATTEMPTS, PASSCODE_KEY } from '../../lib/constants';
import { biometryAuth, resetAttempts } from '../../utils/localAuthentication';
import { biometryAuth, resetAttempts } from '../../lib/methods/helpers/localAuthentication';
import { getDiff, getLockedUntil } from './utils';
import { useUserPreferences } from '../../lib/methods/userPreferences';
import I18n from '../../i18n';

View File

@ -14,7 +14,7 @@ import {
PanGestureHandlerEventPayload
} from 'react-native-gesture-handler';
import Touch from '../../utils/touch';
import Touch from '../../lib/methods/helpers/touch';
import { ACTION_WIDTH, LONG_SWIPE, SMALL_SWIPE } from './styles';
import { LeftActions, RightActions } from './Actions';
import { ITouchableProps } from './interfaces';

View File

@ -3,7 +3,7 @@ import { Text } from 'react-native';
import styles from './styles';
import { themes } from '../../lib/constants';
import { capitalize } from '../../utils/room';
import { capitalize } from '../../lib/methods/helpers/room';
import { IUpdatedAtProps } from './interfaces';
const UpdatedAt = React.memo(({ date, theme, hideUnreadStatus, alert }: IUpdatedAtProps) => {

View File

@ -3,7 +3,7 @@ import { connect } from 'react-redux';
import I18n from '../../i18n';
import { ROW_HEIGHT, ROW_HEIGHT_CONDENSED } from './styles';
import { formatDate } from '../../utils/room';
import { formatDate } from '../../lib/methods/helpers/room';
import RoomItem from './RoomItem';
import { ISubscription, TUserStatus } from '../../definitions';
import { IRoomItemContainerProps } from './interfaces';

View File

@ -6,7 +6,7 @@ import { useTheme } from '../theme';
import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants';
import TextInput from './TextInput';
import { isIOS, isTablet } from '../utils/deviceInfo';
import { isIOS, isTablet } from '../lib/methods/helpers';
import { useOrientation } from '../dimensions';
const styles = StyleSheet.create({

View File

@ -7,7 +7,7 @@ import { IServerInfo } from '../../definitions';
import Check from '../Check';
import styles, { ROW_HEIGHT } from './styles';
import { themes } from '../../lib/constants';
import { isIOS } from '../../utils/deviceInfo';
import { isIOS } from '../../lib/methods/helpers';
import { useTheme } from '../../theme';
export { ROW_HEIGHT };

View File

@ -4,7 +4,7 @@ import EasyToast from 'react-native-easy-toast';
import { themes } from '../lib/constants';
import sharedStyles from '../views/Styles';
import EventEmitter from '../utils/events';
import EventEmitter from '../lib/methods/helpers/events';
import { TSupportedThemes, withTheme } from '../theme';
const styles = StyleSheet.create({

View File

@ -8,7 +8,7 @@ import { connect } from 'react-redux';
import FormTextInput from '../TextInput/FormTextInput';
import I18n from '../../i18n';
import EventEmitter from '../../utils/events';
import EventEmitter from '../../lib/methods/helpers/events';
import { useTheme } from '../../theme';
import { themes } from '../../lib/constants';
import Button from '../Button';

View File

@ -10,7 +10,7 @@ import { textParser } from './utils';
import { themes } from '../../lib/constants';
import sharedStyles from '../../views/Styles';
import { CustomIcon } from '../CustomIcon';
import { isAndroid } from '../../utils/deviceInfo';
import { isAndroid } from '../../lib/methods/helpers';
import { useTheme } from '../../theme';
import ActivityIndicator from '../ActivityIndicator';
import { IDatePicker } from './interfaces';

View File

@ -17,7 +17,7 @@ import FormTextInput from '../../TextInput/FormTextInput';
import { textParser } from '../utils';
import { themes } from '../../../lib/constants';
import I18n from '../../../i18n';
import { isIOS } from '../../../utils/deviceInfo';
import { isIOS } from '../../../lib/methods/helpers';
import { useTheme } from '../../../theme';
import { IText } from '../interfaces';
import Chips from './Chips';

View File

@ -6,7 +6,7 @@ import sharedStyles from '../../views/Styles';
import { themes } from '../../lib/constants';
import { CustomIcon } from '../CustomIcon';
import { textParser } from './utils';
import { isAndroid, isIOS } from '../../utils/deviceInfo';
import { isAndroid, isIOS } from '../../lib/methods/helpers';
import ActivityIndicator from '../ActivityIndicator';
import { useTheme } from '../../theme';
import { IText, Option } from './interfaces';

View File

@ -5,7 +5,7 @@ import Avatar from './Avatar';
import { CustomIcon, TIconsName } from './CustomIcon';
import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants';
import { isIOS } from '../utils/deviceInfo';
import { isIOS } from '../lib/methods/helpers';
import { TSupportedThemes } from '../theme';
const styles = StyleSheet.create({

View File

@ -4,7 +4,7 @@ import { StyleProp, Text, TextStyle } from 'react-native';
import { useTheme } from '../../theme';
import { themes } from '../../lib/constants';
import styles from './styles';
import { events, logEvent } from '../../utils/log';
import { events, logEvent } from '../../lib/methods/helpers/log';
import { IUserMention } from './interfaces';
interface IAtMention {

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Text } from 'react-native';
import shortnameToUnicode from '../../utils/shortnameToUnicode';
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
import CustomEmoji from '../EmojiPicker/CustomEmoji';
import { themes } from '../../lib/constants';
import styles from './styles';

View File

@ -5,9 +5,9 @@ import Clipboard from '@react-native-clipboard/clipboard';
import styles from './styles';
import { themes } from '../../lib/constants';
import { LISTENER } from '../Toast';
import EventEmitter from '../../utils/events';
import EventEmitter from '../../lib/methods/helpers/events';
import I18n from '../../i18n';
import openLink from '../../utils/openLink';
import openLink from '../../lib/methods/helpers/openLink';
import { TOnLinkPress } from './interfaces';
import { TSupportedThemes } from '../../theme';

View File

@ -2,7 +2,7 @@ import React from 'react';
import { Text, TextStyle } from 'react-native';
import removeMarkdown from 'remove-markdown';
import shortnameToUnicode from '../../utils/shortnameToUnicode';
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
import { themes } from '../../lib/constants';
import { formatText } from './formatText';
import { useTheme } from '../../theme';

View File

@ -16,7 +16,7 @@ import MarkdownTableRow from './TableRow';
import MarkdownTableCell from './TableCell';
import mergeTextNodes from './mergeTextNodes';
import styles from './styles';
import { isValidURL } from '../../utils/url';
import { isValidURL } from '../../lib/methods/helpers/url';
import NewMarkdown from './new';
import { formatText } from './formatText';
import { IUserMention, IUserChannel, TOnLinkPress } from './interfaces';

View File

@ -2,7 +2,7 @@ import React, { useContext } from 'react';
import { Text } from 'react-native';
import { Emoji as EmojiProps } from '@rocket.chat/message-parser';
import shortnameToUnicode from '../../../utils/shortnameToUnicode';
import shortnameToUnicode from '../../../lib/methods/helpers/shortnameToUnicode';
import { themes } from '../../../lib/constants';
import { useTheme } from '../../../theme';
import styles from '../styles';

View File

@ -7,8 +7,8 @@ import styles from '../styles';
import I18n from '../../../i18n';
import { LISTENER } from '../../Toast';
import { useTheme } from '../../../theme';
import openLink from '../../../utils/openLink';
import EventEmitter from '../../../utils/events';
import openLink from '../../../lib/methods/helpers/openLink';
import EventEmitter from '../../../lib/methods/helpers/events';
import { themes } from '../../../lib/constants';
import Strike from './Strike';
import Italic from './Italic';

View File

@ -13,7 +13,7 @@ import MessageContext from './Context';
import { useTheme } from '../../theme';
import { IAttachment } from '../../definitions';
import CollapsibleQuote from './Components/CollapsibleQuote';
import openLink from '../../utils/openLink';
import openLink from '../../lib/methods/helpers/openLink';
import { themes } from '../../lib/constants';
export type TElement = {

View File

@ -12,7 +12,7 @@ import Markdown from '../markdown';
import { CustomIcon } from '../CustomIcon';
import sharedStyles from '../../views/Styles';
import { themes } from '../../lib/constants';
import { isAndroid, isIOS } from '../../utils/deviceInfo';
import { isAndroid, isIOS } from '../../lib/methods/helpers';
import MessageContext from './Context';
import ActivityIndicator from '../ActivityIndicator';
import { withDimensions } from '../../dimensions';

View File

@ -9,7 +9,7 @@ import { CustomIcon } from '../CustomIcon';
import { DISCUSSION } from './constants';
import { themes } from '../../lib/constants';
import MessageContext from './Context';
import { formatDateThreads } from '../../utils/room';
import { formatDateThreads } from '../../lib/methods/helpers/room';
import { IMessage } from '../../definitions';
import { useTheme } from '../../theme';

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Text } from 'react-native';
import shortnameToUnicode from '../../utils/shortnameToUnicode';
import shortnameToUnicode from '../../lib/methods/helpers/shortnameToUnicode';
import CustomEmoji from '../EmojiPicker/CustomEmoji';
import { IMessageEmoji } from './interfaces';

View File

@ -6,11 +6,11 @@ import FastImage from 'react-native-fast-image';
import Touchable from './Touchable';
import Markdown from '../markdown';
import openLink from '../../utils/openLink';
import openLink from '../../lib/methods/helpers/openLink';
import sharedStyles from '../../views/Styles';
import { themes } from '../../lib/constants';
import MessageContext from './Context';
import { fileDownloadAndPreview } from '../../utils/fileDownload';
import { fileDownloadAndPreview } from './helpers/fileDownload';
import { IAttachment, TGetCustomEmoji } from '../../definitions';
import RCActivityIndicator from '../ActivityIndicator';
import Attachments from './Attachments';

View File

@ -5,12 +5,12 @@ import FastImage from 'react-native-fast-image';
import { dequal } from 'dequal';
import Touchable from './Touchable';
import openLink from '../../utils/openLink';
import openLink from '../../lib/methods/helpers/openLink';
import sharedStyles from '../../views/Styles';
import { themes } from '../../lib/constants';
import { TSupportedThemes, useTheme, withTheme } from '../../theme';
import { LISTENER } from '../Toast';
import EventEmitter from '../../utils/events';
import EventEmitter from '../../lib/methods/helpers/events';
import I18n from '../../i18n';
import MessageContext from './Context';
import { IUrl } from '../../definitions';

View File

@ -4,12 +4,12 @@ import { dequal } from 'dequal';
import Touchable from './Touchable';
import Markdown from '../markdown';
import { isIOS } from '../../utils/deviceInfo';
import { isIOS } from '../../lib/methods/helpers';
import { CustomIcon } from '../CustomIcon';
import { themes } from '../../lib/constants';
import MessageContext from './Context';
import { fileDownload } from '../../utils/fileDownload';
import EventEmitter from '../../utils/events';
import { fileDownload } from './helpers/fileDownload';
import EventEmitter from '../../lib/methods/helpers/events';
import { LISTENER } from '../Toast';
import I18n from '../../i18n';
import { IAttachment } from '../../definitions/IAttachment';

View File

@ -1,11 +1,11 @@
import RNFetchBlob, { FetchBlobResponse } from 'rn-fetch-blob';
import FileViewer from 'react-native-file-viewer';
import EventEmitter from '../events';
import { LISTENER } from '../../containers/Toast';
import I18n from '../../i18n';
import { DOCUMENTS_PATH, DOWNLOAD_PATH } from '../../lib/constants';
import { IAttachment } from '../../definitions/IAttachment';
import EventEmitter from '../../../../lib/methods/helpers/events';
import { LISTENER } from '../../../Toast';
import I18n from '../../../../i18n';
import { DOCUMENTS_PATH, DOWNLOAD_PATH } from '../../../../lib/constants';
import { IAttachment } from '../../../../definitions';
export const getLocalFilePathFromFile = (localPath: string, attachment: IAttachment): string => `${localPath}${attachment.title}`;

View File

@ -4,10 +4,10 @@ import { Subscription } from 'rxjs';
import Message from './Message';
import MessageContext from './Context';
import debounce from '../../utils/debounce';
import { debounce } from '../../lib/methods/helpers';
import { getMessageTranslation } from './utils';
import { TSupportedThemes, withTheme } from '../../theme';
import openLink from '../../utils/openLink';
import openLink from '../../lib/methods/helpers/openLink';
import { IAttachment, TAnyMessageModel, TGetCustomEmoji } from '../../definitions';
import { IRoomInfoParam } from '../../views/SearchMessagesView';
import { E2E_MESSAGE_TYPE, E2E_STATUS, messagesStatus } from '../../lib/constants';

View File

@ -1,7 +1,7 @@
import { StyleSheet } from 'react-native';
import sharedStyles from '../../views/Styles';
import { isTablet } from '../../utils/deviceInfo';
import { isTablet } from '../../lib/methods/helpers';
export default StyleSheet.create({
root: {

View File

@ -5,8 +5,8 @@ import * as List from '../../../../containers/List';
import styles from './styles';
import { SWITCH_TRACK_COLOR, themes } from '../../../../lib/constants';
import { useTheme } from '../../../../theme';
import { IUser } from '../../../../definitions/IUser';
import { showConfirmationAlert } from '../../../../utils/info';
import { IUser } from '../../../../definitions';
import { showConfirmationAlert } from '../../../../lib/methods/helpers/info';
import I18n from '../../../../i18n';
import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../../lib';
import OmnichannelQueue from './OmnichannelQueue';

View File

@ -1,6 +1,6 @@
import sdk from '../../../lib/services/sdk';
import { IUser } from '../../../definitions';
import EventEmitter from '../../../utils/events';
import EventEmitter from '../../../lib/methods/helpers/events';
import subscribeInquiry from './subscriptions/inquiry';
export const isOmnichannelStatusAvailable = (user: IUser): boolean => user?.statusLivechat === 'available';

View File

@ -1,9 +1,9 @@
import log from '../../../../utils/log';
import log from '../../../../lib/methods/helpers/log';
import { store } from '../../../../lib/store/auxStore';
import { inquiryQueueAdd, inquiryQueueRemove, inquiryQueueUpdate, inquiryRequest } from '../../actions/inquiry';
import sdk from '../../../../lib/services/sdk';
import { IOmnichannelRoom } from '../../../../definitions';
import { hasRole } from '../../../../lib/methods';
import { hasRole } from '../../../../lib/methods/helpers';
import { Services } from '../../../../lib/services';
interface IArgsQueueOmnichannel extends IOmnichannelRoom {

View File

@ -2,7 +2,7 @@ import { put, select, takeLatest } from 'redux-saga/effects';
import * as types from '../../../actions/actionsTypes';
import { Services } from '../../../lib/services';
import EventEmitter from '../../../utils/events';
import EventEmitter from '../../../lib/methods/helpers/events';
import { inquiryFailure, inquirySetEnabled, inquirySuccess } from '../actions/inquiry';
import { getInquiriesQueued, isOmnichannelStatusAvailable } from '../lib';

View File

@ -6,21 +6,20 @@ import { shallowEqual, useSelector } from 'react-redux';
import I18n from '../../../i18n';
import RoomItem, { ROW_HEIGHT } from '../../../containers/RoomItem';
import { isIOS, isTablet } from '../../../utils/deviceInfo';
import { getUserSelector } from '../../../selectors/login';
import { useTheme } from '../../../theme';
import { useDimensions } from '../../../dimensions';
import SafeAreaView from '../../../containers/SafeAreaView';
import StatusBar from '../../../containers/StatusBar';
import { goRoom } from '../../../utils/goRoom';
import { goRoom } from '../../../lib/methods/helpers/goRoom';
import * as HeaderButton from '../../../containers/HeaderButton';
import { events, logEvent } from '../../../utils/log';
import { events, logEvent } from '../../../lib/methods/helpers/log';
import { getInquiryQueueSelector } from '../selectors/inquiry';
import { IOmnichannelRoom, IApplicationState } from '../../../definitions';
import { MAX_SIDEBAR_WIDTH } from '../../../lib/constants';
import { ChatsStackParamList } from '../../../stacks/types';
import { MasterDetailInsideStackParamList } from '../../../stacks/MasterDetailStack/types';
import { getRoomAvatar, getRoomTitle, getUidDirectMessage } from '../../../lib/methods';
import { getRoomAvatar, getRoomTitle, getUidDirectMessage, isIOS, isTablet } from '../../../lib/methods/helpers';
type TNavigation = CompositeNavigationProp<
StackNavigationProp<ChatsStackParamList, 'QueueListView'>,

View File

@ -4,7 +4,7 @@ import * as RNLocalize from 'react-native-localize';
import moment from 'moment';
import 'moment/min/locales';
import { toMomentLocale } from '../utils/moment';
import { toMomentLocale } from './moment';
import { isRTL } from './isRTL';
import englishJson from './locales/en.json';

View File

@ -25,11 +25,10 @@ import { initializePushNotifications, onNotification } from './lib/notifications
import store from './lib/store';
import { initStore } from './lib/store/auxStore';
import { ThemeContext, TSupportedThemes } from './theme';
import debounce from './utils/debounce';
import { isTablet } from './utils/deviceInfo';
import EventEmitter from './utils/events';
import { toggleAnalyticsEventsReport, toggleCrashErrorsReport } from './utils/log';
import { getTheme, initialTheme, newThemeState, subscribeTheme, unsubscribeTheme } from './utils/theme';
import { debounce, isTablet } from './lib/methods/helpers';
import EventEmitter from './lib/methods/helpers/events';
import { toggleAnalyticsEventsReport, toggleCrashErrorsReport } from './lib/methods/helpers/log';
import { getTheme, initialTheme, newThemeState, subscribeTheme, unsubscribeTheme } from './lib/methods/helpers/theme';
import ChangePasscodeView from './views/ChangePasscodeView';
import ScreenLockedView from './views/ScreenLockedView';

View File

@ -1,4 +1,4 @@
import { getBundleId, isIOS } from '../../utils/deviceInfo';
import { getBundleId, isIOS } from '../methods/helpers';
const APP_STORE_ID = '1148741252';

View File

@ -1,6 +1,6 @@
import { NativeModules } from 'react-native';
import { isIOS } from './deviceInfo';
import { isIOS } from '../methods/helpers';
const { AppGroup } = NativeModules;

View File

@ -2,8 +2,8 @@ import { Database } from '@nozbe/watermelondb';
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
import logger from '@nozbe/watermelondb/utils/common/logger';
import { isIOS } from '../../utils/deviceInfo';
import appGroup from '../../utils/appGroup';
import { isIOS } from '../methods/helpers';
import appGroup from './appGroup';
import { isOfficial } from '../constants';
import Subscription from './model/Subscription';
import Room from './model/Room';

View File

@ -6,8 +6,8 @@ import { Q, Model } from '@nozbe/watermelondb';
import UserPreferences from '../methods/userPreferences';
import database from '../database';
import protectedFunction from '../methods/helpers/protectedFunction';
import Deferred from '../../utils/deferred';
import log from '../../utils/log';
import Deferred from './helpers/deferred';
import log from '../methods/helpers/log';
import { store } from '../store/auxStore';
import { joinVectorData, randomPassword, splitVectorData, toString, utf8ToBuffer } from './utils';
import { EncryptionRoom } from './index';

View File

@ -3,11 +3,11 @@ import { Base64 } from 'js-base64';
import SimpleCrypto from 'react-native-simple-crypto';
import ByteBuffer from 'bytebuffer';
import { IMessage } from '../../definitions';
import Deferred from '../../utils/deferred';
import debounce from '../../utils/debounce';
import { IMessage, IUser } from '../../definitions';
import Deferred from './helpers/deferred';
import { debounce } from '../methods/helpers';
import database from '../database';
import log from '../../utils/log';
import log from '../methods/helpers/log';
import {
b64ToBuffer,
bufferToB64,
@ -19,7 +19,6 @@ import {
utf8ToBuffer
} from './utils';
import { Encryption } from './index';
import { IUser } from '../../definitions/IUser';
import { E2E_MESSAGE_TYPE, E2E_STATUS } from '../constants';
import { Services } from '../services';

View File

@ -1,8 +1,8 @@
import ByteBuffer from 'bytebuffer';
import SimpleCrypto from 'react-native-simple-crypto';
import random from '../../utils/random';
import { fromByteArray, toByteArray } from '../../utils/base64-js';
import { random } from '../methods/helpers';
import { fromByteArray, toByteArray } from './helpers/base64-js';
const BASE64URI = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';

View File

@ -1,7 +1,7 @@
import { ITriggerAction, IUserInteraction, ModalActions } from '../../containers/UIKit/interfaces';
import EventEmitter from '../../utils/events';
import fetch from '../../utils/fetch';
import random from '../../utils/random';
import EventEmitter from './helpers/events';
import fetch from './helpers/fetch';
import { random } from './helpers';
import Navigation from '../navigation/appNavigation';
import sdk from '../services/sdk';

View File

@ -1,5 +1,5 @@
import { ISubscription } from '../../definitions';
import { events, logEvent } from '../../utils/log';
import { events, logEvent } from './helpers/log';
import { store } from '../store/auxStore';
import Navigation from '../navigation/appNavigation';
import sdk from '../services/sdk';

View File

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

View File

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

View File

@ -1,4 +1,4 @@
import log from '../../utils/log';
import log from './helpers/log';
import { TMessageModel, TSubscriptionModel } from '../../definitions';
import { store } from '../store/auxStore';
import { isGroupChat } from './helpers';

View File

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

View File

@ -3,7 +3,7 @@ import Model from '@nozbe/watermelondb/Model';
import database from '../database';
import { getRoleById } from '../database/services/Role';
import log from '../../utils/log';
import log from './helpers/log';
import { store as reduxStore } from '../store/auxStore';
import { removeRoles, setRoles as setRolesAction, updateRoles } from '../../actions/roles';
import { TRoleModel } from '../../definitions';

View File

@ -4,8 +4,8 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import { addSettings, clearSettings } from '../../actions/settings';
import { DEFAULT_AUTO_LOCK, defaultSettings } from '../constants';
import { IPreparedSettings, ISettingsIcon } from '../../definitions';
import fetch from '../../utils/fetch';
import log from '../../utils/log';
import fetch from './helpers/fetch';
import log from './helpers/log';
import { store as reduxStore } from '../store/auxStore';
import database from '../database';
import sdk from '../services/sdk';

View File

@ -1,7 +1,7 @@
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import database from '../database';
import log from '../../utils/log';
import log from './helpers/log';
import protectedFunction from './helpers/protectedFunction';
import { ISlashCommandResult, TSlashCommandModel } from '../../definitions';
import sdk from '../services/sdk';

View File

@ -3,7 +3,7 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
import database from '../database';
import { getMessageById } from '../database/services/Message';
import { getThreadById } from '../database/services/Thread';
import log from '../../utils/log';
import log from './helpers/log';
import { Encryption } from '../encryption';
import getSingleMessage from './getSingleMessage';
import { IMessage, IThread, TThreadModel } from '../../definitions';

View File

@ -8,7 +8,7 @@ import { setUser } from '../../actions/login';
import database from '../database';
import { IUser } from '../../definitions';
import sdk from '../services/sdk';
import { compareServerVersion } from './helpers/compareServerVersion';
import { compareServerVersion } from './helpers';
export const _activeUsersSubTimeout: { activeUsersSubTimeout: boolean | ReturnType<typeof setTimeout> | number } = {
activeUsersSubTimeout: false

View File

@ -1,4 +1,4 @@
export default function debounce(func: Function, wait?: number, immediate?: boolean) {
export function debounce(func: Function, wait?: number, immediate?: boolean) {
let timeout: ReturnType<typeof setTimeout> | null;
function _debounce(...args: any[]) {
// @ts-ignore

View File

@ -1,5 +1,5 @@
import { IEmitUserInteraction } from '../containers/UIKit/interfaces';
import { ICommand } from '../definitions/ICommand';
import { IEmitUserInteraction } from '../../../containers/UIKit/interfaces';
import { ICommand } from '../../../definitions/ICommand';
import log from './log';
type TEventEmitterEmmitArgs =

View File

@ -1,10 +1,10 @@
import { SubscriptionType } from '../definitions/ISubscription';
import { IAvatar } from '../containers/Avatar/interfaces';
import { compareServerVersion } from '../lib/methods/helpers/compareServerVersion';
import { SubscriptionType } from '../../../definitions';
import { IAvatar } from '../../../containers/Avatar/interfaces';
import { compareServerVersion } from './compareServerVersion';
const formatUrl = (url: string, size: number, query?: string) => `${url}?format=png&size=${size}${query}`;
export const avatarURL = ({
export const getAvatarURL = ({
type,
text,
size = 25,

View File

@ -1,8 +1,8 @@
import { ChatsStackParamList } from '../stacks/types';
import Navigation from '../lib/navigation/appNavigation';
import { IOmnichannelRoom, SubscriptionType, IVisitor, TSubscriptionModel, ISubscription } from '../definitions';
import { getRoomTitle, getUidDirectMessage } from '../lib/methods';
import { Services } from '../lib/services';
import { ChatsStackParamList } from '../../../stacks/types';
import Navigation from '../../navigation/appNavigation';
import { IOmnichannelRoom, SubscriptionType, IVisitor, TSubscriptionModel, ISubscription } from '../../../definitions';
import { getRoomTitle, getUidDirectMessage } from './helpers';
import { Services } from '../../services';
interface IGoRoomItem {
search?: boolean; // comes from spotlight

View File

@ -1,7 +1,7 @@
// @ts-nocheck - TEMP
import log from '../../utils/log';
import { store as reduxStore } from '../store/auxStore';
import database from '../database';
import log from './log';
import { store as reduxStore } from '../../store/auxStore';
import database from '../../database';
export function isGroupChat(room): boolean {
return ((room.uids && room.uids.length > 2) || (room.usernames && room.usernames.length > 2)) ?? false;

View File

@ -0,0 +1,16 @@
export * from './helpers';
export * from './compareServerVersion';
export * from './debounce';
export * from './deviceInfo';
export * from './formatAttachmentUrl';
export * from './generateLoadMoreId';
export * from './getAvatarUrl';
export * from './layoutAnimation';
export * from './info';
export * from './isReadOnly';
export * from './media';
export * from './room';
export * from './server';
export * from './url';
export * from './isValidEmail';
export * from './random';

View File

@ -1,6 +1,6 @@
import { Alert } from 'react-native';
import I18n from '../i18n';
import I18n from '../../../i18n';
export const showErrorAlert = (message: string, title?: string, onPress = () => {}): void =>
Alert.alert(title!, message, [{ text: 'OK', onPress }], { cancelable: true });

View File

@ -1,6 +1,6 @@
import { store as reduxStore } from '../lib/store/auxStore';
import { ISubscription } from '../definitions/ISubscription';
import { hasPermission } from '../lib/methods';
import { store as reduxStore } from '../../store/auxStore';
import { ISubscription } from '../../../definitions';
import { hasPermission } from './helpers';
const canPostReadOnly = async ({ rid }: { rid: string }) => {
// TODO: this is not reactive. If this permission changes, the component won't be updated

View File

@ -1,4 +1,4 @@
export default function isValidEmail(email: string): boolean {
export function isValidEmail(email: string): boolean {
/* eslint-disable no-useless-escape */
const reg =
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

View File

@ -1,6 +1,6 @@
import { LayoutAnimation } from 'react-native';
import debounce from './debounce';
import { debounce } from '.';
import { isIOS } from './deviceInfo';
export const animateNextTransition = debounce(

View File

@ -4,10 +4,10 @@ import AsyncStorage from '@react-native-community/async-storage';
import { sha256 } from 'js-sha256';
import moment from 'moment';
import UserPreferences from '../lib/methods/userPreferences';
import { store } from '../lib/store/auxStore';
import database from '../lib/database';
import { getServerTimeSync } from '../lib/services/getServerTimeSync';
import UserPreferences from '../userPreferences';
import { store } from '../../store/auxStore';
import database from '../../database';
import { getServerTimeSync } from '../../services/getServerTimeSync';
import {
ATTEMPTS_KEY,
BIOMETRY_ENABLED_KEY,
@ -15,10 +15,10 @@ import {
LOCAL_AUTHENTICATE_EMITTER,
LOCKED_OUT_TIMER_KEY,
PASSCODE_KEY
} from '../lib/constants';
import I18n from '../i18n';
import { setLocalAuthenticated } from '../actions/login';
import { TServerModel } from '../definitions/IServer';
} from '../../constants';
import I18n from '../../../i18n';
import { setLocalAuthenticated } from '../../../actions/login';
import { TServerModel } from '../../../definitions';
import EventEmitter from './events';
import { isIOS } from './deviceInfo';

Some files were not shown because too many files have changed in this diff Show More