From 614d9afe65a94a37a7dcadf139cc6199c7f86c16 Mon Sep 17 00:00:00 2001 From: Alex Junior Date: Mon, 6 Jun 2022 11:17:51 -0300 Subject: [PATCH] Chore: Evaluate helpers and utils - Typescript (#4146) --- app/AppContainer.tsx | 4 +-- app/containers/ActionSheet/ActionSheet.tsx | 2 +- app/containers/ActionSheet/Button.ts | 4 +-- app/containers/AppVersion.tsx | 2 +- app/containers/Avatar/Avatar.tsx | 6 ++-- app/containers/DirectoryItem/index.tsx | 2 +- app/containers/EmojiPicker/EmojiCategory.tsx | 4 +-- app/containers/EmojiPicker/index.tsx | 4 +-- app/containers/FormContainer.tsx | 4 +-- app/containers/Header/index.tsx | 4 +-- app/containers/HeaderButton/Common.tsx | 2 +- .../InAppNotification/NotifierComponent.tsx | 2 +- app/containers/InAppNotification/index.tsx | 4 +-- app/containers/KeyboardView.tsx | 2 +- app/containers/List/ListContainer.tsx | 2 +- app/containers/List/ListItem.tsx | 2 +- app/containers/LoginServices.tsx | 6 ++-- app/containers/MessageActions/Header.tsx | 2 +- app/containers/MessageActions/index.tsx | 11 ++++--- .../MessageBox/Mentions/MentionEmoji.tsx | 2 +- app/containers/MessageBox/RecordAudio.tsx | 2 +- .../MessageBox/forceJpgExtension.ts | 2 +- app/containers/MessageBox/index.tsx | 14 ++++----- app/containers/MessageBox/styles.ts | 2 +- app/containers/MessageErrorActions.tsx | 2 +- app/containers/Passcode/Base/Button.tsx | 2 +- app/containers/Passcode/Base/Locked.tsx | 2 +- app/containers/Passcode/PasscodeEnter.tsx | 2 +- app/containers/RoomItem/Touchable.tsx | 2 +- app/containers/RoomItem/UpdatedAt.tsx | 2 +- app/containers/RoomItem/index.tsx | 2 +- app/containers/SearchHeader.tsx | 2 +- app/containers/ServerItem/index.tsx | 2 +- app/containers/Toast.tsx | 2 +- app/containers/TwoFactor/index.tsx | 2 +- app/containers/UIKit/DatePicker.tsx | 2 +- app/containers/UIKit/MultiSelect/index.tsx | 2 +- app/containers/UIKit/Select.tsx | 2 +- app/containers/UserItem.tsx | 2 +- app/containers/markdown/AtMention.tsx | 2 +- app/containers/markdown/Emoji.tsx | 2 +- app/containers/markdown/Link.tsx | 4 +-- app/containers/markdown/Preview.tsx | 2 +- app/containers/markdown/index.tsx | 2 +- app/containers/markdown/new/Emoji.tsx | 2 +- app/containers/markdown/new/Link.tsx | 4 +-- app/containers/message/Attachments.tsx | 2 +- app/containers/message/Audio.tsx | 2 +- app/containers/message/Discussion.tsx | 2 +- app/containers/message/Emoji.tsx | 2 +- app/containers/message/Reply.tsx | 4 +-- app/containers/message/Urls.tsx | 4 +-- app/containers/message/Video.tsx | 6 ++-- .../message/helpers}/fileDownload/index.ts | 10 +++--- app/containers/message/index.tsx | 4 +-- app/containers/message/styles.ts | 2 +- .../containers/OmnichannelHeader/index.tsx | 4 +-- app/ee/omnichannel/lib/index.ts | 2 +- .../omnichannel/lib/subscriptions/inquiry.ts | 4 +-- app/ee/omnichannel/sagas/inquiry.js | 2 +- app/ee/omnichannel/views/QueueListView.tsx | 7 ++--- app/i18n/index.ts | 2 +- app/{utils => i18n}/moment.ts | 0 app/index.tsx | 9 +++--- app/lib/constants/links.ts | 2 +- app/{utils => lib/database}/appGroup.ts | 2 +- app/lib/database/index.ts | 4 +-- app/lib/encryption/encryption.ts | 4 +-- .../helpers}/base64-js/base64-js.test.js | 0 .../encryption/helpers}/base64-js/index.ts | 0 .../encryption/helpers}/deferred.ts | 0 app/lib/encryption/room.ts | 9 +++--- app/lib/encryption/utils.ts | 4 +-- app/lib/methods/actions.ts | 6 ++-- app/lib/methods/callJitsi.ts | 2 +- app/lib/methods/enterpriseModules.ts | 4 +-- app/lib/methods/getCustomEmojis.ts | 4 +-- app/lib/methods/getPermalinks.ts | 2 +- app/lib/methods/getPermissions.ts | 4 +-- app/lib/methods/getRoles.ts | 2 +- app/lib/methods/getSettings.ts | 4 +-- app/lib/methods/getSlashCommands.ts | 2 +- app/lib/methods/getThreadName.ts | 2 +- app/lib/methods/getUsersPresence.ts | 2 +- .../methods/helpers}/debounce.ts | 2 +- .../methods/helpers}/deviceInfo.ts | 0 app/{utils => lib/methods/helpers}/events.ts | 4 +-- app/{utils => lib/methods/helpers}/fetch.ts | 0 .../methods/helpers}/fileUpload/index.ios.ts | 0 .../methods/helpers}/fileUpload/index.ts | 0 .../methods/helpers}/fileUpload/interfaces.ts | 0 .../methods/helpers/getAvatarUrl.ts} | 8 ++--- app/{utils => lib/methods/helpers}/goRoom.ts | 10 +++--- app/lib/methods/{ => helpers}/helpers.ts | 6 ++-- app/lib/methods/helpers/index.ts | 16 ++++++++++ app/{utils => lib/methods/helpers}/info.ts | 2 +- .../methods/helpers}/isReadOnly.ts | 6 ++-- .../methods/helpers}/isValidEmail.ts | 2 +- .../methods/helpers}/layoutAnimation.ts | 2 +- .../methods/helpers}/localAuthentication.ts | 16 +++++----- .../methods/helpers}/log/events.ts | 0 .../methods/helpers}/log/index.ts | 2 +- app/{utils => lib/methods/helpers}/media.ts | 2 +- .../methods/helpers}/navigation/animations.ts | 0 .../helpers}/navigation/conditional.ts | 0 .../methods/helpers}/navigation/index.ts | 4 +-- .../methods/helpers}/openLink.ts | 6 ++-- app/{utils => lib/methods/helpers}/random.ts | 2 +- app/{utils => lib/methods/helpers}/review.ts | 4 +-- app/{utils => lib/methods/helpers}/room.ts | 9 +++--- .../methods/helpers}/scrollPersistTaps.ts | 0 app/{utils => lib/methods/helpers}/server.ts | 0 .../helpers}/shortnameToUnicode/ascii.ts | 0 .../helpers}/shortnameToUnicode/emojis.ts | 0 .../helpers}/shortnameToUnicode/index.ts | 0 .../shortnameToUnicode.test.js | 0 app/lib/methods/helpers/showToast.ts | 2 +- .../methods/helpers}/sslPinning.ts | 6 ++-- app/{utils => lib/methods/helpers}/theme.ts | 8 ++--- app/{utils => lib/methods/helpers}/touch.tsx | 4 +-- app/{utils => lib/methods/helpers}/url.ts | 0 app/lib/methods/index.ts | 1 - app/lib/methods/loadMessagesForRoom.ts | 2 +- app/lib/methods/loadMissedMessages.ts | 2 +- app/lib/methods/loadNextMessages.ts | 2 +- app/lib/methods/loadSurroundingMessages.ts | 2 +- app/lib/methods/loadThreadMessages.ts | 2 +- app/lib/methods/logout.ts | 7 ++--- app/lib/methods/readMessages.ts | 2 +- app/lib/methods/sendFileMessage.ts | 6 ++-- app/lib/methods/sendMessage.ts | 4 +-- app/lib/methods/setUser.ts | 2 +- app/lib/methods/shareExtension.ts | 4 +-- app/lib/methods/subscribeRooms.ts | 2 +- app/lib/methods/subscriptions/room.ts | 4 +-- app/lib/methods/subscriptions/rooms.ts | 9 +++--- app/lib/notifications/push.ts | 4 +-- app/lib/services/connect.ts | 13 +++----- app/lib/services/restApi.ts | 3 +- app/lib/services/sdk.ts | 4 +-- app/{utils => lib/services}/twoFactor.ts | 4 +-- app/sagas/createChannel.js | 6 ++-- app/sagas/createDiscussion.js | 2 +- app/sagas/deepLinking.js | 11 ++++--- app/sagas/encryption.js | 4 +-- app/sagas/init.js | 4 +-- app/sagas/inviteLinks.js | 4 +-- app/sagas/login.js | 8 ++--- app/sagas/messages.js | 4 +-- app/sagas/room.js | 6 ++-- app/sagas/rooms.js | 2 +- app/sagas/selectServer.js | 6 ++-- app/sagas/state.js | 4 +-- app/share.tsx | 10 +++--- app/stacks/InsideStack.tsx | 2 +- app/stacks/MasterDetailStack/index.tsx | 8 ++++- app/stacks/OutsideStack.tsx | 2 +- app/views/AddExistingChannelView.tsx | 11 +++---- app/views/AttachmentView.tsx | 8 ++--- app/views/AuthenticationWebView.tsx | 3 +- app/views/AutoTranslateView/index.tsx | 2 +- app/views/CannedResponseDetail.tsx | 4 +-- .../Dropdown/DropdownItem.tsx | 2 +- app/views/CannedResponsesListView/index.tsx | 9 +++--- app/views/ChangePasscodeView.tsx | 4 +-- app/views/CreateChannelView.tsx | 8 ++--- .../CreateDiscussionView/SelectChannel.tsx | 8 ++--- .../CreateDiscussionView/SelectUsers.tsx | 8 ++--- app/views/CreateDiscussionView/index.tsx | 10 +++--- app/views/DefaultBrowserView.tsx | 6 ++-- app/views/DirectoryView/Options.tsx | 2 +- app/views/DirectoryView/index.tsx | 8 ++--- app/views/DiscussionsView/Item.tsx | 2 +- app/views/DiscussionsView/index.tsx | 5 ++- app/views/DisplayPrefsView.tsx | 2 +- app/views/E2EEncryptionSecurityView.tsx | 8 ++--- app/views/E2EEnterYourPasswordView.tsx | 4 +-- app/views/E2ESaveYourPasswordView.tsx | 6 ++-- app/views/ForgotPasswordView.tsx | 5 ++- app/views/InviteUsersEditView/index.tsx | 2 +- app/views/InviteUsersView/index.tsx | 4 +-- app/views/JitsiMeetView.tsx | 4 +-- app/views/LanguageView/index.tsx | 4 +-- app/views/LegalView.tsx | 2 +- app/views/LivechatEditView.tsx | 6 ++-- app/views/MarkdownTableView.tsx | 2 +- .../MessagesView}/getFileUrlFromMessage.ts | 0 app/views/MessagesView/index.tsx | 2 +- app/views/ModalBlockView.tsx | 2 +- app/views/NewMessageView.tsx | 10 +++--- app/views/NewServerView/ServerInput/Item.tsx | 2 +- app/views/NewServerView/index.tsx | 14 ++++----- app/{utils => views/NewServerView}/scaling.ts | 2 +- .../NotificationPreferencesView/index.tsx | 2 +- app/views/PickerView.tsx | 2 +- app/views/ProfileView/index.tsx | 10 +++--- app/views/RegisterView.tsx | 7 ++--- app/views/RoomActionsView/index.tsx | 15 +++++---- app/views/RoomInfoEditView/index.tsx | 20 +++++++----- .../RoomInfoEditView}/messageTypes.ts | 0 app/views/RoomInfoView/index.tsx | 9 +++--- app/views/RoomMembersView/index.tsx | 13 ++++---- app/views/RoomView/List/List.tsx | 4 +-- app/views/RoomView/List/NavBottomFAB.tsx | 4 +-- app/views/RoomView/List/index.tsx | 7 ++--- app/views/RoomView/LoadMore/index.tsx | 2 +- app/views/RoomView/ReactionPicker.tsx | 2 +- app/views/RoomView/RightButtons.tsx | 4 +-- app/views/RoomView/UploadProgress.tsx | 2 +- app/views/RoomView/index.tsx | 31 ++++++++++--------- app/views/RoomsListView/Header/Header.tsx | 2 +- app/views/RoomsListView/Header/index.tsx | 6 ++-- app/views/RoomsListView/ServerDropdown.tsx | 12 +++---- app/views/RoomsListView/index.tsx | 19 ++++++------ app/views/ScreenLockConfigView.tsx | 4 +-- app/views/ScreenLockedView.tsx | 4 +-- app/views/SearchMessagesView/index.tsx | 23 ++++++++------ app/views/SecurityPrivacyView.tsx | 4 +-- app/views/SelectListView.tsx | 4 +-- app/views/SelectedUsersView.tsx | 7 +++-- app/views/SendEmailConfirmationView.tsx | 5 ++- app/views/SetUsernameView.tsx | 6 ++-- app/views/SettingsView/index.tsx | 12 +++---- app/views/ShareListView/Header/Header.ios.tsx | 2 +- app/views/ShareListView/Header/SearchBox.tsx | 2 +- app/views/ShareListView/index.tsx | 5 ++- app/views/ShareListView/styles.ts | 2 +- app/views/ShareView/Header.tsx | 5 ++- app/views/ShareView/Preview.tsx | 2 +- app/views/ShareView/Thumbs.tsx | 2 +- app/views/ShareView/index.tsx | 10 +++--- app/views/ShareView/utils.ts | 2 +- app/views/SidebarView/SidebarItem.tsx | 2 +- app/views/SidebarView/index.tsx | 4 +-- app/views/StatusView/index.tsx | 4 +-- app/views/TeamChannelsView.tsx | 10 +++--- app/views/ThemeView.tsx | 4 +-- .../Dropdown/DropdownItem.tsx | 2 +- app/views/ThreadMessagesView/Item.tsx | 2 +- app/views/ThreadMessagesView/index.tsx | 10 +++--- app/views/UserPreferencesView/index.tsx | 2 +- app/views/WorkspaceView/ServerAvatar.tsx | 2 +- 242 files changed, 528 insertions(+), 520 deletions(-) rename app/{utils => containers/message/helpers}/fileDownload/index.ts (83%) rename app/{utils => i18n}/moment.ts (100%) rename app/{utils => lib/database}/appGroup.ts (80%) rename app/{utils => lib/encryption/helpers}/base64-js/base64-js.test.js (100%) rename app/{utils => lib/encryption/helpers}/base64-js/index.ts (100%) rename app/{utils => lib/encryption/helpers}/deferred.ts (100%) rename app/{utils => lib/methods/helpers}/debounce.ts (86%) rename app/{utils => lib/methods/helpers}/deviceInfo.ts (100%) rename app/{utils => lib/methods/helpers}/events.ts (90%) rename app/{utils => lib/methods/helpers}/fetch.ts (100%) rename app/{utils => lib/methods/helpers}/fileUpload/index.ios.ts (100%) rename app/{utils => lib/methods/helpers}/fileUpload/index.ts (100%) rename app/{utils => lib/methods/helpers}/fileUpload/interfaces.ts (100%) rename app/{utils/avatar.ts => lib/methods/helpers/getAvatarUrl.ts} (81%) rename app/{utils => lib/methods/helpers}/goRoom.ts (86%) rename app/lib/methods/{ => helpers}/helpers.ts (96%) create mode 100644 app/lib/methods/helpers/index.ts rename app/{utils => lib/methods/helpers}/info.ts (95%) rename app/{utils => lib/methods/helpers}/isReadOnly.ts (83%) rename app/{utils => lib/methods/helpers}/isValidEmail.ts (78%) rename app/{utils => lib/methods/helpers}/layoutAnimation.ts (93%) rename app/{utils => lib/methods/helpers}/localAuthentication.ts (93%) rename app/{utils => lib/methods/helpers}/log/events.ts (100%) rename app/{utils => lib/methods/helpers}/log/index.ts (97%) rename app/{utils => lib/methods/helpers}/media.ts (95%) rename app/{utils => lib/methods/helpers}/navigation/animations.ts (100%) rename app/{utils => lib/methods/helpers}/navigation/conditional.ts (100%) rename app/{utils => lib/methods/helpers}/navigation/index.ts (93%) rename app/{utils => lib/methods/helpers}/openLink.ts (91%) rename app/{utils => lib/methods/helpers}/random.ts (80%) rename app/{utils => lib/methods/helpers}/review.ts (96%) rename app/{utils => lib/methods/helpers}/room.ts (86%) rename app/{utils => lib/methods/helpers}/scrollPersistTaps.ts (100%) rename app/{utils => lib/methods/helpers}/server.ts (100%) rename app/{utils => lib/methods/helpers}/shortnameToUnicode/ascii.ts (100%) rename app/{utils => lib/methods/helpers}/shortnameToUnicode/emojis.ts (100%) rename app/{utils => lib/methods/helpers}/shortnameToUnicode/index.ts (100%) rename app/{utils => lib/methods/helpers}/shortnameToUnicode/shortnameToUnicode.test.js (100%) rename app/{utils => lib/methods/helpers}/sslPinning.ts (93%) rename app/{utils => lib/methods/helpers}/theme.ts (91%) rename app/{utils => lib/methods/helpers}/touch.tsx (90%) rename app/{utils => lib/methods/helpers}/url.ts (100%) rename app/{utils => lib/services}/twoFactor.ts (84%) rename app/{lib/methods/helpers => views/MessagesView}/getFileUrlFromMessage.ts (100%) rename app/{utils => views/NewServerView}/scaling.ts (91%) rename app/{utils => views/RoomInfoEditView}/messageTypes.ts (100%) diff --git a/app/AppContainer.tsx b/app/AppContainer.tsx index f67b38c7f..90e48eecb 100644 --- a/app/AppContainer.tsx +++ b/app/AppContainer.tsx @@ -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(); diff --git a/app/containers/ActionSheet/ActionSheet.tsx b/app/containers/ActionSheet/ActionSheet.tsx index c028bada6..c5cd66dee 100644 --- a/app/containers/ActionSheet/ActionSheet.tsx +++ b/app/containers/ActionSheet/ActionSheet.tsx @@ -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'; diff --git a/app/containers/ActionSheet/Button.ts b/app/containers/ActionSheet/Button.ts index 186cc6851..e742b89a4 100644 --- a/app/containers/ActionSheet/Button.ts +++ b/app/containers/ActionSheet/Button.ts @@ -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; diff --git a/app/containers/AppVersion.tsx b/app/containers/AppVersion.tsx index d67e70941..59845f0b6 100644 --- a/app/containers/AppVersion.tsx +++ b/app/containers/AppVersion.tsx @@ -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'; diff --git a/app/containers/Avatar/Avatar.tsx b/app/containers/Avatar/Avatar.tsx index 7ed3fceb1..4f2da1806 100644 --- a/app/containers/Avatar/Avatar.tsx +++ b/app/containers/Avatar/Avatar.tsx @@ -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, diff --git a/app/containers/DirectoryItem/index.tsx b/app/containers/DirectoryItem/index.tsx index 1fbd254de..c56ac6573 100644 --- a/app/containers/DirectoryItem/index.tsx +++ b/app/containers/DirectoryItem/index.tsx @@ -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'; diff --git a/app/containers/EmojiPicker/EmojiCategory.tsx b/app/containers/EmojiPicker/EmojiCategory.tsx index 683c0a74f..a7fb07b11 100644 --- a/app/containers/EmojiPicker/EmojiCategory.tsx +++ b/app/containers/EmojiPicker/EmojiCategory.tsx @@ -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; diff --git a/app/containers/EmojiPicker/index.tsx b/app/containers/EmojiPicker/index.tsx index 4fc35a0f0..4bfa17b6a 100644 --- a/app/containers/EmojiPicker/index.tsx +++ b/app/containers/EmojiPicker/index.tsx @@ -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'; diff --git a/app/containers/FormContainer.tsx b/app/containers/FormContainer.tsx index ae73db6ed..36af98164 100644 --- a/app/containers/FormContainer.tsx +++ b/app/containers/FormContainer.tsx @@ -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 { diff --git a/app/containers/Header/index.tsx b/app/containers/Header/index.tsx index 997d23086..0b0452708 100644 --- a/app/containers/Header/index.tsx +++ b/app/containers/Header/index.tsx @@ -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; diff --git a/app/containers/HeaderButton/Common.tsx b/app/containers/HeaderButton/Common.tsx index 50206f836..de53c3a6a 100644 --- a/app/containers/HeaderButton/Common.tsx +++ b/app/containers/HeaderButton/Common.tsx @@ -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'; diff --git a/app/containers/InAppNotification/NotifierComponent.tsx b/app/containers/InAppNotification/NotifierComponent.tsx index 1862da6aa..63b361910 100644 --- a/app/containers/InAppNotification/NotifierComponent.tsx +++ b/app/containers/InAppNotification/NotifierComponent.tsx @@ -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'; diff --git a/app/containers/InAppNotification/index.tsx b/app/containers/InAppNotification/index.tsx index 49e227389..34354e632 100644 --- a/app/containers/InAppNotification/index.tsx +++ b/app/containers/InAppNotification/index.tsx @@ -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'; diff --git a/app/containers/KeyboardView.tsx b/app/containers/KeyboardView.tsx index 894b8fb5e..09284b524 100644 --- a/app/containers/KeyboardView.tsx +++ b/app/containers/KeyboardView.tsx @@ -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; diff --git a/app/containers/List/ListContainer.tsx b/app/containers/List/ListContainer.tsx index 349c71bee..96fe0e34f 100644 --- a/app/containers/List/ListContainer.tsx +++ b/app/containers/List/ListContainer.tsx @@ -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: { diff --git a/app/containers/List/ListItem.tsx b/app/containers/List/ListItem.tsx index 47f9f7866..6308bc0eb 100644 --- a/app/containers/List/ListItem.tsx +++ b/app/containers/List/ListItem.tsx @@ -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'; diff --git a/app/containers/LoginServices.tsx b/app/containers/LoginServices.tsx index d596b3820..0cec2ebcf 100644 --- a/app/containers/LoginServices.tsx +++ b/app/containers/LoginServices.tsx @@ -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'; diff --git a/app/containers/MessageActions/Header.tsx b/app/containers/MessageActions/Header.tsx index cf4c71a92..b4c3d79f2 100644 --- a/app/containers/MessageActions/Header.tsx +++ b/app/containers/MessageActions/Header.tsx @@ -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'; diff --git a/app/containers/MessageActions/index.tsx b/app/containers/MessageActions/index.tsx index 811d01180..1b204e7ac 100644 --- a/app/containers/MessageActions/index.tsx +++ b/app/containers/MessageActions/index.tsx @@ -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 { diff --git a/app/containers/MessageBox/Mentions/MentionEmoji.tsx b/app/containers/MessageBox/Mentions/MentionEmoji.tsx index a6c589acf..3503d7057 100644 --- a/app/containers/MessageBox/Mentions/MentionEmoji.tsx +++ b/app/containers/MessageBox/Mentions/MentionEmoji.tsx @@ -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'; diff --git a/app/containers/MessageBox/RecordAudio.tsx b/app/containers/MessageBox/RecordAudio.tsx index 37d17201b..4b550b62b 100644 --- a/app/containers/MessageBox/RecordAudio.tsx +++ b/app/containers/MessageBox/RecordAudio.tsx @@ -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 { diff --git a/app/containers/MessageBox/forceJpgExtension.ts b/app/containers/MessageBox/forceJpgExtension.ts index 68e49c876..dedbc7a7b 100644 --- a/app/containers/MessageBox/forceJpgExtension.ts +++ b/app/containers/MessageBox/forceJpgExtension.ts @@ -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 diff --git a/app/containers/MessageBox/index.tsx b/app/containers/MessageBox/index.tsx index 6b6b1deb7..cd81bedcc 100644 --- a/app/containers/MessageBox/index.tsx +++ b/app/containers/MessageBox/index.tsx @@ -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'; diff --git a/app/containers/MessageBox/styles.ts b/app/containers/MessageBox/styles.ts index 6f4599090..387ffdce0 100644 --- a/app/containers/MessageBox/styles.ts +++ b/app/containers/MessageBox/styles.ts @@ -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; diff --git a/app/containers/MessageErrorActions.tsx b/app/containers/MessageErrorActions.tsx index de5829e9f..724f8aaae 100644 --- a/app/containers/MessageErrorActions.tsx +++ b/app/containers/MessageErrorActions.tsx @@ -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'; diff --git a/app/containers/Passcode/Base/Button.tsx b/app/containers/Passcode/Base/Button.tsx index 745e90957..a9088cbda 100644 --- a/app/containers/Passcode/Base/Button.tsx +++ b/app/containers/Passcode/Base/Button.tsx @@ -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'; diff --git a/app/containers/Passcode/Base/Locked.tsx b/app/containers/Passcode/Base/Locked.tsx index a78be5ac4..43f5c7c30 100644 --- a/app/containers/Passcode/Base/Locked.tsx +++ b/app/containers/Passcode/Base/Locked.tsx @@ -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'; diff --git a/app/containers/Passcode/PasscodeEnter.tsx b/app/containers/Passcode/PasscodeEnter.tsx index 992877c7d..2acbba945 100644 --- a/app/containers/Passcode/PasscodeEnter.tsx +++ b/app/containers/Passcode/PasscodeEnter.tsx @@ -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'; diff --git a/app/containers/RoomItem/Touchable.tsx b/app/containers/RoomItem/Touchable.tsx index bb479bd28..7a5fa0959 100644 --- a/app/containers/RoomItem/Touchable.tsx +++ b/app/containers/RoomItem/Touchable.tsx @@ -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'; diff --git a/app/containers/RoomItem/UpdatedAt.tsx b/app/containers/RoomItem/UpdatedAt.tsx index c2d287fae..fde4ae6df 100644 --- a/app/containers/RoomItem/UpdatedAt.tsx +++ b/app/containers/RoomItem/UpdatedAt.tsx @@ -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) => { diff --git a/app/containers/RoomItem/index.tsx b/app/containers/RoomItem/index.tsx index f64eaf6e0..4dd4f9786 100644 --- a/app/containers/RoomItem/index.tsx +++ b/app/containers/RoomItem/index.tsx @@ -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'; diff --git a/app/containers/SearchHeader.tsx b/app/containers/SearchHeader.tsx index 6b5e31fc1..9f637a446 100644 --- a/app/containers/SearchHeader.tsx +++ b/app/containers/SearchHeader.tsx @@ -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({ diff --git a/app/containers/ServerItem/index.tsx b/app/containers/ServerItem/index.tsx index f85c0990d..fe9adfadd 100644 --- a/app/containers/ServerItem/index.tsx +++ b/app/containers/ServerItem/index.tsx @@ -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 }; diff --git a/app/containers/Toast.tsx b/app/containers/Toast.tsx index aa30a9147..c7f0f1045 100644 --- a/app/containers/Toast.tsx +++ b/app/containers/Toast.tsx @@ -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({ diff --git a/app/containers/TwoFactor/index.tsx b/app/containers/TwoFactor/index.tsx index 8aa6a16dd..d060f31da 100644 --- a/app/containers/TwoFactor/index.tsx +++ b/app/containers/TwoFactor/index.tsx @@ -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'; diff --git a/app/containers/UIKit/DatePicker.tsx b/app/containers/UIKit/DatePicker.tsx index f8ddaebc3..ea90e347b 100644 --- a/app/containers/UIKit/DatePicker.tsx +++ b/app/containers/UIKit/DatePicker.tsx @@ -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'; diff --git a/app/containers/UIKit/MultiSelect/index.tsx b/app/containers/UIKit/MultiSelect/index.tsx index 33bd3da44..2b0092a34 100644 --- a/app/containers/UIKit/MultiSelect/index.tsx +++ b/app/containers/UIKit/MultiSelect/index.tsx @@ -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'; diff --git a/app/containers/UIKit/Select.tsx b/app/containers/UIKit/Select.tsx index 4fe9500ea..974a91d63 100644 --- a/app/containers/UIKit/Select.tsx +++ b/app/containers/UIKit/Select.tsx @@ -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'; diff --git a/app/containers/UserItem.tsx b/app/containers/UserItem.tsx index 952ea7928..dfd7c6061 100644 --- a/app/containers/UserItem.tsx +++ b/app/containers/UserItem.tsx @@ -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({ diff --git a/app/containers/markdown/AtMention.tsx b/app/containers/markdown/AtMention.tsx index 2402ff087..30fb586e7 100644 --- a/app/containers/markdown/AtMention.tsx +++ b/app/containers/markdown/AtMention.tsx @@ -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 { diff --git a/app/containers/markdown/Emoji.tsx b/app/containers/markdown/Emoji.tsx index e93ce323c..8abfd8161 100644 --- a/app/containers/markdown/Emoji.tsx +++ b/app/containers/markdown/Emoji.tsx @@ -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'; diff --git a/app/containers/markdown/Link.tsx b/app/containers/markdown/Link.tsx index 95991a1f1..d3dce93db 100644 --- a/app/containers/markdown/Link.tsx +++ b/app/containers/markdown/Link.tsx @@ -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'; diff --git a/app/containers/markdown/Preview.tsx b/app/containers/markdown/Preview.tsx index 8cffc15ed..f1ba0d19f 100644 --- a/app/containers/markdown/Preview.tsx +++ b/app/containers/markdown/Preview.tsx @@ -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'; diff --git a/app/containers/markdown/index.tsx b/app/containers/markdown/index.tsx index b860dadb6..16c86d1d0 100644 --- a/app/containers/markdown/index.tsx +++ b/app/containers/markdown/index.tsx @@ -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'; diff --git a/app/containers/markdown/new/Emoji.tsx b/app/containers/markdown/new/Emoji.tsx index 9d101c4ff..a7d1810ae 100644 --- a/app/containers/markdown/new/Emoji.tsx +++ b/app/containers/markdown/new/Emoji.tsx @@ -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'; diff --git a/app/containers/markdown/new/Link.tsx b/app/containers/markdown/new/Link.tsx index 096d9e7f0..db6d23212 100644 --- a/app/containers/markdown/new/Link.tsx +++ b/app/containers/markdown/new/Link.tsx @@ -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'; diff --git a/app/containers/message/Attachments.tsx b/app/containers/message/Attachments.tsx index 3eebfbb79..ddbed86f0 100644 --- a/app/containers/message/Attachments.tsx +++ b/app/containers/message/Attachments.tsx @@ -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 = { diff --git a/app/containers/message/Audio.tsx b/app/containers/message/Audio.tsx index d356b7c9c..7fee11056 100644 --- a/app/containers/message/Audio.tsx +++ b/app/containers/message/Audio.tsx @@ -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'; diff --git a/app/containers/message/Discussion.tsx b/app/containers/message/Discussion.tsx index a466cf045..58f9ecbca 100644 --- a/app/containers/message/Discussion.tsx +++ b/app/containers/message/Discussion.tsx @@ -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'; diff --git a/app/containers/message/Emoji.tsx b/app/containers/message/Emoji.tsx index 0481c5926..395665e4c 100644 --- a/app/containers/message/Emoji.tsx +++ b/app/containers/message/Emoji.tsx @@ -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'; diff --git a/app/containers/message/Reply.tsx b/app/containers/message/Reply.tsx index c3cde1cb5..c7564d323 100644 --- a/app/containers/message/Reply.tsx +++ b/app/containers/message/Reply.tsx @@ -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'; diff --git a/app/containers/message/Urls.tsx b/app/containers/message/Urls.tsx index cd948366c..90ba3f9ae 100644 --- a/app/containers/message/Urls.tsx +++ b/app/containers/message/Urls.tsx @@ -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'; diff --git a/app/containers/message/Video.tsx b/app/containers/message/Video.tsx index 52d85d720..1730824c6 100644 --- a/app/containers/message/Video.tsx +++ b/app/containers/message/Video.tsx @@ -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'; diff --git a/app/utils/fileDownload/index.ts b/app/containers/message/helpers/fileDownload/index.ts similarity index 83% rename from app/utils/fileDownload/index.ts rename to app/containers/message/helpers/fileDownload/index.ts index c087875de..73c7faa82 100644 --- a/app/utils/fileDownload/index.ts +++ b/app/containers/message/helpers/fileDownload/index.ts @@ -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}`; diff --git a/app/containers/message/index.tsx b/app/containers/message/index.tsx index cf44167d7..7af7f0899 100644 --- a/app/containers/message/index.tsx +++ b/app/containers/message/index.tsx @@ -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'; diff --git a/app/containers/message/styles.ts b/app/containers/message/styles.ts index f91fad1f4..03c746d9e 100644 --- a/app/containers/message/styles.ts +++ b/app/containers/message/styles.ts @@ -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: { diff --git a/app/ee/omnichannel/containers/OmnichannelHeader/index.tsx b/app/ee/omnichannel/containers/OmnichannelHeader/index.tsx index eed3f478a..51a9cfc4d 100644 --- a/app/ee/omnichannel/containers/OmnichannelHeader/index.tsx +++ b/app/ee/omnichannel/containers/OmnichannelHeader/index.tsx @@ -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'; diff --git a/app/ee/omnichannel/lib/index.ts b/app/ee/omnichannel/lib/index.ts index 5ee8e1c59..d8a97d1de 100644 --- a/app/ee/omnichannel/lib/index.ts +++ b/app/ee/omnichannel/lib/index.ts @@ -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'; diff --git a/app/ee/omnichannel/lib/subscriptions/inquiry.ts b/app/ee/omnichannel/lib/subscriptions/inquiry.ts index a918e48eb..07ea70c60 100644 --- a/app/ee/omnichannel/lib/subscriptions/inquiry.ts +++ b/app/ee/omnichannel/lib/subscriptions/inquiry.ts @@ -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 { diff --git a/app/ee/omnichannel/sagas/inquiry.js b/app/ee/omnichannel/sagas/inquiry.js index ec728e537..e45f0b9b0 100644 --- a/app/ee/omnichannel/sagas/inquiry.js +++ b/app/ee/omnichannel/sagas/inquiry.js @@ -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'; diff --git a/app/ee/omnichannel/views/QueueListView.tsx b/app/ee/omnichannel/views/QueueListView.tsx index 7e5ff2c13..ed6719fc1 100644 --- a/app/ee/omnichannel/views/QueueListView.tsx +++ b/app/ee/omnichannel/views/QueueListView.tsx @@ -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, diff --git a/app/i18n/index.ts b/app/i18n/index.ts index 3b948c104..0f3da57ab 100644 --- a/app/i18n/index.ts +++ b/app/i18n/index.ts @@ -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'; diff --git a/app/utils/moment.ts b/app/i18n/moment.ts similarity index 100% rename from app/utils/moment.ts rename to app/i18n/moment.ts diff --git a/app/index.tsx b/app/index.tsx index 76daa3300..a29f8bbe1 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -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'; diff --git a/app/lib/constants/links.ts b/app/lib/constants/links.ts index cedad74a1..15573c353 100644 --- a/app/lib/constants/links.ts +++ b/app/lib/constants/links.ts @@ -1,4 +1,4 @@ -import { getBundleId, isIOS } from '../../utils/deviceInfo'; +import { getBundleId, isIOS } from '../methods/helpers'; const APP_STORE_ID = '1148741252'; diff --git a/app/utils/appGroup.ts b/app/lib/database/appGroup.ts similarity index 80% rename from app/utils/appGroup.ts rename to app/lib/database/appGroup.ts index f92227c03..0a5a66066 100644 --- a/app/utils/appGroup.ts +++ b/app/lib/database/appGroup.ts @@ -1,6 +1,6 @@ import { NativeModules } from 'react-native'; -import { isIOS } from './deviceInfo'; +import { isIOS } from '../methods/helpers'; const { AppGroup } = NativeModules; diff --git a/app/lib/database/index.ts b/app/lib/database/index.ts index 0f3f5e7f5..5175810dd 100644 --- a/app/lib/database/index.ts +++ b/app/lib/database/index.ts @@ -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'; diff --git a/app/lib/encryption/encryption.ts b/app/lib/encryption/encryption.ts index f24e483e7..18e026e32 100644 --- a/app/lib/encryption/encryption.ts +++ b/app/lib/encryption/encryption.ts @@ -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'; diff --git a/app/utils/base64-js/base64-js.test.js b/app/lib/encryption/helpers/base64-js/base64-js.test.js similarity index 100% rename from app/utils/base64-js/base64-js.test.js rename to app/lib/encryption/helpers/base64-js/base64-js.test.js diff --git a/app/utils/base64-js/index.ts b/app/lib/encryption/helpers/base64-js/index.ts similarity index 100% rename from app/utils/base64-js/index.ts rename to app/lib/encryption/helpers/base64-js/index.ts diff --git a/app/utils/deferred.ts b/app/lib/encryption/helpers/deferred.ts similarity index 100% rename from app/utils/deferred.ts rename to app/lib/encryption/helpers/deferred.ts diff --git a/app/lib/encryption/room.ts b/app/lib/encryption/room.ts index db8233445..da1fe8b4c 100644 --- a/app/lib/encryption/room.ts +++ b/app/lib/encryption/room.ts @@ -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'; diff --git a/app/lib/encryption/utils.ts b/app/lib/encryption/utils.ts index 97ba23f07..27268bb82 100644 --- a/app/lib/encryption/utils.ts +++ b/app/lib/encryption/utils.ts @@ -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-_'; diff --git a/app/lib/methods/actions.ts b/app/lib/methods/actions.ts index edf63fc44..b672bb887 100644 --- a/app/lib/methods/actions.ts +++ b/app/lib/methods/actions.ts @@ -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'; diff --git a/app/lib/methods/callJitsi.ts b/app/lib/methods/callJitsi.ts index fcfd450ed..b6e836408 100644 --- a/app/lib/methods/callJitsi.ts +++ b/app/lib/methods/callJitsi.ts @@ -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'; diff --git a/app/lib/methods/enterpriseModules.ts b/app/lib/methods/enterpriseModules.ts index b5ce4e74a..0e40675a0 100644 --- a/app/lib/methods/enterpriseModules.ts +++ b/app/lib/methods/enterpriseModules.ts @@ -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'; diff --git a/app/lib/methods/getCustomEmojis.ts b/app/lib/methods/getCustomEmojis.ts index c2a431105..50c3289d7 100644 --- a/app/lib/methods/getCustomEmojis.ts +++ b/app/lib/methods/getCustomEmojis.ts @@ -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[]; diff --git a/app/lib/methods/getPermalinks.ts b/app/lib/methods/getPermalinks.ts index f244b9871..b85571159 100644 --- a/app/lib/methods/getPermalinks.ts +++ b/app/lib/methods/getPermalinks.ts @@ -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'; diff --git a/app/lib/methods/getPermissions.ts b/app/lib/methods/getPermissions.ts index 58aeba0da..33fdc203b 100644 --- a/app/lib/methods/getPermissions.ts +++ b/app/lib/methods/getPermissions.ts @@ -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', diff --git a/app/lib/methods/getRoles.ts b/app/lib/methods/getRoles.ts index 93f7596d2..83195855c 100644 --- a/app/lib/methods/getRoles.ts +++ b/app/lib/methods/getRoles.ts @@ -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'; diff --git a/app/lib/methods/getSettings.ts b/app/lib/methods/getSettings.ts index 76f10aa41..d68f2b914 100644 --- a/app/lib/methods/getSettings.ts +++ b/app/lib/methods/getSettings.ts @@ -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'; diff --git a/app/lib/methods/getSlashCommands.ts b/app/lib/methods/getSlashCommands.ts index 2c197227c..efb996a90 100644 --- a/app/lib/methods/getSlashCommands.ts +++ b/app/lib/methods/getSlashCommands.ts @@ -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'; diff --git a/app/lib/methods/getThreadName.ts b/app/lib/methods/getThreadName.ts index 3f4c42882..a8c47933e 100644 --- a/app/lib/methods/getThreadName.ts +++ b/app/lib/methods/getThreadName.ts @@ -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'; diff --git a/app/lib/methods/getUsersPresence.ts b/app/lib/methods/getUsersPresence.ts index a94ce6563..6d4a3d0b7 100644 --- a/app/lib/methods/getUsersPresence.ts +++ b/app/lib/methods/getUsersPresence.ts @@ -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 | number } = { activeUsersSubTimeout: false diff --git a/app/utils/debounce.ts b/app/lib/methods/helpers/debounce.ts similarity index 86% rename from app/utils/debounce.ts rename to app/lib/methods/helpers/debounce.ts index 4d777fff7..edc7c5ac8 100644 --- a/app/utils/debounce.ts +++ b/app/lib/methods/helpers/debounce.ts @@ -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 | null; function _debounce(...args: any[]) { // @ts-ignore diff --git a/app/utils/deviceInfo.ts b/app/lib/methods/helpers/deviceInfo.ts similarity index 100% rename from app/utils/deviceInfo.ts rename to app/lib/methods/helpers/deviceInfo.ts diff --git a/app/utils/events.ts b/app/lib/methods/helpers/events.ts similarity index 90% rename from app/utils/events.ts rename to app/lib/methods/helpers/events.ts index 0364cab96..e5684b685 100644 --- a/app/utils/events.ts +++ b/app/lib/methods/helpers/events.ts @@ -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 = diff --git a/app/utils/fetch.ts b/app/lib/methods/helpers/fetch.ts similarity index 100% rename from app/utils/fetch.ts rename to app/lib/methods/helpers/fetch.ts diff --git a/app/utils/fileUpload/index.ios.ts b/app/lib/methods/helpers/fileUpload/index.ios.ts similarity index 100% rename from app/utils/fileUpload/index.ios.ts rename to app/lib/methods/helpers/fileUpload/index.ios.ts diff --git a/app/utils/fileUpload/index.ts b/app/lib/methods/helpers/fileUpload/index.ts similarity index 100% rename from app/utils/fileUpload/index.ts rename to app/lib/methods/helpers/fileUpload/index.ts diff --git a/app/utils/fileUpload/interfaces.ts b/app/lib/methods/helpers/fileUpload/interfaces.ts similarity index 100% rename from app/utils/fileUpload/interfaces.ts rename to app/lib/methods/helpers/fileUpload/interfaces.ts diff --git a/app/utils/avatar.ts b/app/lib/methods/helpers/getAvatarUrl.ts similarity index 81% rename from app/utils/avatar.ts rename to app/lib/methods/helpers/getAvatarUrl.ts index 2569e8d02..1c4c18dd3 100644 --- a/app/utils/avatar.ts +++ b/app/lib/methods/helpers/getAvatarUrl.ts @@ -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, diff --git a/app/utils/goRoom.ts b/app/lib/methods/helpers/goRoom.ts similarity index 86% rename from app/utils/goRoom.ts rename to app/lib/methods/helpers/goRoom.ts index 0ad369e0c..a57d2e19f 100644 --- a/app/utils/goRoom.ts +++ b/app/lib/methods/helpers/goRoom.ts @@ -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 diff --git a/app/lib/methods/helpers.ts b/app/lib/methods/helpers/helpers.ts similarity index 96% rename from app/lib/methods/helpers.ts rename to app/lib/methods/helpers/helpers.ts index 695b4a82b..d496b7167 100644 --- a/app/lib/methods/helpers.ts +++ b/app/lib/methods/helpers/helpers.ts @@ -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; diff --git a/app/lib/methods/helpers/index.ts b/app/lib/methods/helpers/index.ts new file mode 100644 index 000000000..0c9414e9c --- /dev/null +++ b/app/lib/methods/helpers/index.ts @@ -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'; diff --git a/app/utils/info.ts b/app/lib/methods/helpers/info.ts similarity index 95% rename from app/utils/info.ts rename to app/lib/methods/helpers/info.ts index da882ee41..d3b85c334 100644 --- a/app/utils/info.ts +++ b/app/lib/methods/helpers/info.ts @@ -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 }); diff --git a/app/utils/isReadOnly.ts b/app/lib/methods/helpers/isReadOnly.ts similarity index 83% rename from app/utils/isReadOnly.ts rename to app/lib/methods/helpers/isReadOnly.ts index 2cb6c11e9..81977ab70 100644 --- a/app/utils/isReadOnly.ts +++ b/app/lib/methods/helpers/isReadOnly.ts @@ -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 diff --git a/app/utils/isValidEmail.ts b/app/lib/methods/helpers/isValidEmail.ts similarity index 78% rename from app/utils/isValidEmail.ts rename to app/lib/methods/helpers/isValidEmail.ts index e230fc328..5c212f7f7 100644 --- a/app/utils/isValidEmail.ts +++ b/app/lib/methods/helpers/isValidEmail.ts @@ -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,}))$/; diff --git a/app/utils/layoutAnimation.ts b/app/lib/methods/helpers/layoutAnimation.ts similarity index 93% rename from app/utils/layoutAnimation.ts rename to app/lib/methods/helpers/layoutAnimation.ts index d4a26627d..afe79f014 100644 --- a/app/utils/layoutAnimation.ts +++ b/app/lib/methods/helpers/layoutAnimation.ts @@ -1,6 +1,6 @@ import { LayoutAnimation } from 'react-native'; -import debounce from './debounce'; +import { debounce } from '.'; import { isIOS } from './deviceInfo'; export const animateNextTransition = debounce( diff --git a/app/utils/localAuthentication.ts b/app/lib/methods/helpers/localAuthentication.ts similarity index 93% rename from app/utils/localAuthentication.ts rename to app/lib/methods/helpers/localAuthentication.ts index ec72efbb1..6d10f17c8 100644 --- a/app/utils/localAuthentication.ts +++ b/app/lib/methods/helpers/localAuthentication.ts @@ -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'; diff --git a/app/utils/log/events.ts b/app/lib/methods/helpers/log/events.ts similarity index 100% rename from app/utils/log/events.ts rename to app/lib/methods/helpers/log/events.ts diff --git a/app/utils/log/index.ts b/app/lib/methods/helpers/log/index.ts similarity index 97% rename from app/utils/log/index.ts rename to app/lib/methods/helpers/log/index.ts index 88ccc8d36..076d19299 100644 --- a/app/utils/log/index.ts +++ b/app/lib/methods/helpers/log/index.ts @@ -1,6 +1,6 @@ import firebaseAnalytics from '@react-native-firebase/analytics'; -import { isFDroidBuild } from '../../lib/constants'; +import { isFDroidBuild } from '../../../constants'; import events from './events'; const analytics = firebaseAnalytics || ''; diff --git a/app/utils/media.ts b/app/lib/methods/helpers/media.ts similarity index 95% rename from app/utils/media.ts rename to app/lib/methods/helpers/media.ts index 47e5d4d0b..470aacfc1 100644 --- a/app/utils/media.ts +++ b/app/lib/methods/helpers/media.ts @@ -1,4 +1,4 @@ -import { IShareAttachment } from '../definitions'; +import { IShareAttachment } from '../../../definitions'; export const canUploadFile = ({ file, diff --git a/app/utils/navigation/animations.ts b/app/lib/methods/helpers/navigation/animations.ts similarity index 100% rename from app/utils/navigation/animations.ts rename to app/lib/methods/helpers/navigation/animations.ts diff --git a/app/utils/navigation/conditional.ts b/app/lib/methods/helpers/navigation/conditional.ts similarity index 100% rename from app/utils/navigation/conditional.ts rename to app/lib/methods/helpers/navigation/conditional.ts diff --git a/app/utils/navigation/index.ts b/app/lib/methods/helpers/navigation/index.ts similarity index 93% rename from app/utils/navigation/index.ts rename to app/lib/methods/helpers/navigation/index.ts index 38622c0f9..139802c6b 100644 --- a/app/utils/navigation/index.ts +++ b/app/lib/methods/helpers/navigation/index.ts @@ -1,8 +1,8 @@ import { StyleSheet } from 'react-native'; import { DarkTheme, DefaultTheme } from '@react-navigation/native'; -import { themes } from '../../lib/constants'; -import { TSupportedThemes } from '../../theme'; +import { themes } from '../../../constants'; +import { TSupportedThemes } from '../../../../theme'; export * from './animations'; diff --git a/app/utils/openLink.ts b/app/lib/methods/helpers/openLink.ts similarity index 91% rename from app/utils/openLink.ts rename to app/lib/methods/helpers/openLink.ts index 65959bd20..e7fc9a561 100644 --- a/app/utils/openLink.ts +++ b/app/lib/methods/helpers/openLink.ts @@ -2,9 +2,9 @@ import { Linking } from 'react-native'; import * as WebBrowser from 'expo-web-browser'; import parse from 'url-parse'; -import { themes } from '../lib/constants'; -import { TSupportedThemes } from '../theme'; -import UserPreferences from '../lib/methods/userPreferences'; +import { themes } from '../../constants'; +import { TSupportedThemes } from '../../../theme'; +import UserPreferences from '../userPreferences'; export const DEFAULT_BROWSER_KEY = 'DEFAULT_BROWSER_KEY'; diff --git a/app/utils/random.ts b/app/lib/methods/helpers/random.ts similarity index 80% rename from app/utils/random.ts rename to app/lib/methods/helpers/random.ts index 2d2cd178b..44968a5d7 100644 --- a/app/utils/random.ts +++ b/app/lib/methods/helpers/random.ts @@ -1,4 +1,4 @@ -export default function random(length: number): string { +export function random(length: number): string { let text = ''; const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for (let i = 0; i < length; i += 1) { diff --git a/app/utils/review.ts b/app/lib/methods/helpers/review.ts similarity index 96% rename from app/utils/review.ts rename to app/lib/methods/helpers/review.ts index 8b58e8593..56928f2e7 100644 --- a/app/utils/review.ts +++ b/app/lib/methods/helpers/review.ts @@ -1,8 +1,8 @@ import { Alert, Linking } from 'react-native'; import AsyncStorage from '@react-native-community/async-storage'; -import I18n from '../i18n'; -import { isFDroidBuild, STORE_REVIEW_LINK } from '../lib/constants'; +import I18n from '../../../i18n'; +import { isFDroidBuild, STORE_REVIEW_LINK } from '../../constants'; import { showErrorAlert } from './info'; import { isIOS } from './deviceInfo'; import { events, logEvent } from './log'; diff --git a/app/utils/room.ts b/app/lib/methods/helpers/room.ts similarity index 86% rename from app/utils/room.ts rename to app/lib/methods/helpers/room.ts index 0fa1dbe22..a50b502c3 100644 --- a/app/utils/room.ts +++ b/app/lib/methods/helpers/room.ts @@ -1,10 +1,9 @@ import moment from 'moment'; -import { themes } from '../lib/constants'; -import I18n from '../i18n'; -import { IAttachment } from '../definitions/IAttachment'; -import { SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription'; -import { TSupportedThemes } from '../theme'; +import { themes } from '../../constants'; +import I18n from '../../../i18n'; +import { IAttachment, SubscriptionType, TSubscriptionModel } from '../../../definitions'; +import { TSupportedThemes } from '../../../theme'; export const isBlocked = (room: TSubscriptionModel): boolean => { if (room) { diff --git a/app/utils/scrollPersistTaps.ts b/app/lib/methods/helpers/scrollPersistTaps.ts similarity index 100% rename from app/utils/scrollPersistTaps.ts rename to app/lib/methods/helpers/scrollPersistTaps.ts diff --git a/app/utils/server.ts b/app/lib/methods/helpers/server.ts similarity index 100% rename from app/utils/server.ts rename to app/lib/methods/helpers/server.ts diff --git a/app/utils/shortnameToUnicode/ascii.ts b/app/lib/methods/helpers/shortnameToUnicode/ascii.ts similarity index 100% rename from app/utils/shortnameToUnicode/ascii.ts rename to app/lib/methods/helpers/shortnameToUnicode/ascii.ts diff --git a/app/utils/shortnameToUnicode/emojis.ts b/app/lib/methods/helpers/shortnameToUnicode/emojis.ts similarity index 100% rename from app/utils/shortnameToUnicode/emojis.ts rename to app/lib/methods/helpers/shortnameToUnicode/emojis.ts diff --git a/app/utils/shortnameToUnicode/index.ts b/app/lib/methods/helpers/shortnameToUnicode/index.ts similarity index 100% rename from app/utils/shortnameToUnicode/index.ts rename to app/lib/methods/helpers/shortnameToUnicode/index.ts diff --git a/app/utils/shortnameToUnicode/shortnameToUnicode.test.js b/app/lib/methods/helpers/shortnameToUnicode/shortnameToUnicode.test.js similarity index 100% rename from app/utils/shortnameToUnicode/shortnameToUnicode.test.js rename to app/lib/methods/helpers/shortnameToUnicode/shortnameToUnicode.test.js diff --git a/app/lib/methods/helpers/showToast.ts b/app/lib/methods/helpers/showToast.ts index 77400b165..5402615dc 100644 --- a/app/lib/methods/helpers/showToast.ts +++ b/app/lib/methods/helpers/showToast.ts @@ -1,4 +1,4 @@ import { LISTENER } from '../../../containers/Toast'; -import EventEmitter from '../../../utils/events'; +import EventEmitter from './events'; export const showToast = (message: string): void => EventEmitter.emit(LISTENER, { message }); diff --git a/app/utils/sslPinning.ts b/app/lib/methods/helpers/sslPinning.ts similarity index 93% rename from app/utils/sslPinning.ts rename to app/lib/methods/helpers/sslPinning.ts index 3517ae4af..24b58726b 100644 --- a/app/utils/sslPinning.ts +++ b/app/lib/methods/helpers/sslPinning.ts @@ -2,10 +2,10 @@ import { Alert, NativeModules, Platform } from 'react-native'; import DocumentPicker from 'react-native-document-picker'; import * as FileSystem from 'expo-file-system'; -import UserPreferences from '../lib/methods/userPreferences'; -import I18n from '../i18n'; +import UserPreferences from '../userPreferences'; +import I18n from '../../../i18n'; import { extractHostname } from './server'; -import { ICertificate } from '../definitions'; +import { ICertificate } from '../../../definitions'; const { SSLPinning } = NativeModules; const { documentDirectory } = FileSystem; diff --git a/app/utils/theme.ts b/app/lib/methods/helpers/theme.ts similarity index 91% rename from app/utils/theme.ts rename to app/lib/methods/helpers/theme.ts index 3f8779135..096f0c45e 100644 --- a/app/utils/theme.ts +++ b/app/lib/methods/helpers/theme.ts @@ -2,10 +2,10 @@ import { Appearance } from 'react-native-appearance'; import changeNavigationBarColor from 'react-native-navigation-bar-color'; import setRootViewColor from 'rn-root-view'; -import { IThemePreference, TThemeMode } from '../definitions/ITheme'; -import { themes, THEME_PREFERENCES_KEY } from '../lib/constants'; -import UserPreferences from '../lib/methods/userPreferences'; -import { TSupportedThemes } from '../theme'; +import { IThemePreference, TThemeMode } from '../../../definitions/ITheme'; +import { themes, THEME_PREFERENCES_KEY } from '../../constants'; +import UserPreferences from '../userPreferences'; +import { TSupportedThemes } from '../../../theme'; import { isAndroid } from './deviceInfo'; let themeListener: { remove: () => void } | null; diff --git a/app/utils/touch.tsx b/app/lib/methods/helpers/touch.tsx similarity index 90% rename from app/utils/touch.tsx rename to app/lib/methods/helpers/touch.tsx index 668b8770e..834f63745 100644 --- a/app/utils/touch.tsx +++ b/app/lib/methods/helpers/touch.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { RectButton, RectButtonProps } from 'react-native-gesture-handler'; -import { TSupportedThemes } from '../theme'; -import { themes } from '../lib/constants'; +import { TSupportedThemes } from '../../../theme'; +import { themes } from '../../constants'; interface ITouchProps extends RectButtonProps { children: React.ReactNode; diff --git a/app/utils/url.ts b/app/lib/methods/helpers/url.ts similarity index 100% rename from app/utils/url.ts rename to app/lib/methods/helpers/url.ts diff --git a/app/lib/methods/index.ts b/app/lib/methods/index.ts index 72478500e..35b8cf512 100644 --- a/app/lib/methods/index.ts +++ b/app/lib/methods/index.ts @@ -15,7 +15,6 @@ export * from './getSingleMessage'; export * from './getSlashCommands'; export * from './getThreadName'; export * from './getUsersPresence'; -export * from './helpers'; export * from './loadMessagesForRoom'; export * from './loadMissedMessages'; export * from './loadNextMessages'; diff --git a/app/lib/methods/loadMessagesForRoom.ts b/app/lib/methods/loadMessagesForRoom.ts index d1e55ed67..4d329beef 100644 --- a/app/lib/methods/loadMessagesForRoom.ts +++ b/app/lib/methods/loadMessagesForRoom.ts @@ -2,7 +2,7 @@ import moment from 'moment'; import { MessageTypeLoad } from '../constants'; import { IMessage, TMessageModel } from '../../definitions'; -import log from '../../utils/log'; +import log from './helpers/log'; import { getMessageById } from '../database/services/Message'; import { RoomTypes, roomTypeToApiType } from './roomTypeToApiType'; import sdk from '../services/sdk'; diff --git a/app/lib/methods/loadMissedMessages.ts b/app/lib/methods/loadMissedMessages.ts index aff5e1530..31be751bf 100644 --- a/app/lib/methods/loadMissedMessages.ts +++ b/app/lib/methods/loadMissedMessages.ts @@ -1,5 +1,5 @@ import { ILastMessage } from '../../definitions'; -import log from '../../utils/log'; +import log from './helpers/log'; import database from '../database'; import sdk from '../services/sdk'; import updateMessages from './updateMessages'; diff --git a/app/lib/methods/loadNextMessages.ts b/app/lib/methods/loadNextMessages.ts index 055d34f89..5a650c732 100644 --- a/app/lib/methods/loadNextMessages.ts +++ b/app/lib/methods/loadNextMessages.ts @@ -2,7 +2,7 @@ import EJSON from 'ejson'; import moment from 'moment'; import orderBy from 'lodash/orderBy'; -import log from '../../utils/log'; +import log from './helpers/log'; import { getMessageById } from '../database/services/Message'; import { MessageTypeLoad } from '../constants'; import updateMessages from './updateMessages'; diff --git a/app/lib/methods/loadSurroundingMessages.ts b/app/lib/methods/loadSurroundingMessages.ts index 973bd05cd..a1017b219 100644 --- a/app/lib/methods/loadSurroundingMessages.ts +++ b/app/lib/methods/loadSurroundingMessages.ts @@ -2,7 +2,7 @@ import EJSON from 'ejson'; import moment from 'moment'; import orderBy from 'lodash/orderBy'; -import log from '../../utils/log'; +import log from './helpers/log'; import { getMessageById } from '../database/services/Message'; import { MessageTypeLoad } from '../constants'; import sdk from '../services/sdk'; diff --git a/app/lib/methods/loadThreadMessages.ts b/app/lib/methods/loadThreadMessages.ts index 2dc49b14e..6a73891ba 100644 --- a/app/lib/methods/loadThreadMessages.ts +++ b/app/lib/methods/loadThreadMessages.ts @@ -3,7 +3,7 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import EJSON from 'ejson'; import database from '../database'; -import log from '../../utils/log'; +import log from './helpers/log'; import { Encryption } from '../encryption'; import protectedFunction from './helpers/protectedFunction'; import buildMessage from './helpers/buildMessage'; diff --git a/app/lib/methods/logout.ts b/app/lib/methods/logout.ts index d36b0864b..0371ab4a9 100644 --- a/app/lib/methods/logout.ts +++ b/app/lib/methods/logout.ts @@ -3,11 +3,10 @@ import { Rocketchat as RocketchatClient } from '@rocket.chat/sdk'; import Model from '@nozbe/watermelondb/Model'; import { getDeviceToken } from '../notifications'; -import { extractHostname } from '../../utils/server'; -import { BASIC_AUTH_KEY } from '../../utils/fetch'; +import { extractHostname, isSsl } from './helpers'; +import { BASIC_AUTH_KEY } from './helpers/fetch'; import database, { getDatabase } from '../database'; -import { isSsl } from '../../utils/url'; -import log from '../../utils/log'; +import log from './helpers/log'; import { ICertificate } from '../../definitions'; import sdk from '../services/sdk'; import { CURRENT_SERVER, E2E_PRIVATE_KEY, E2E_PUBLIC_KEY, E2E_RANDOM_PASSWORD_KEY, TOKEN_KEY } from '../constants'; diff --git a/app/lib/methods/readMessages.ts b/app/lib/methods/readMessages.ts index 36f6dfbd0..05adfde7d 100644 --- a/app/lib/methods/readMessages.ts +++ b/app/lib/methods/readMessages.ts @@ -1,5 +1,5 @@ import database from '../database'; -import log from '../../utils/log'; +import log from './helpers/log'; import { TSubscriptionModel } from '../../definitions'; import sdk from '../services/sdk'; diff --git a/app/lib/methods/sendFileMessage.ts b/app/lib/methods/sendFileMessage.ts index e282f5555..c8facc473 100644 --- a/app/lib/methods/sendFileMessage.ts +++ b/app/lib/methods/sendFileMessage.ts @@ -3,11 +3,11 @@ import { settings as RocketChatSettings } from '@rocket.chat/sdk'; import { FetchBlobResponse, StatefulPromise } from 'rn-fetch-blob'; import isEmpty from 'lodash/isEmpty'; -import FileUpload from '../../utils/fileUpload'; +import FileUpload from './helpers/fileUpload'; import database from '../database'; -import log from '../../utils/log'; +import log from './helpers/log'; import { IUpload, IUser, TUploadModel } from '../../definitions'; -import { IFileUpload } from '../../utils/fileUpload/interfaces'; +import { IFileUpload } from './helpers/fileUpload/interfaces'; const uploadQueue: { [index: string]: StatefulPromise } = {}; diff --git a/app/lib/methods/sendMessage.ts b/app/lib/methods/sendMessage.ts index 0d14c849e..fe1678d18 100644 --- a/app/lib/methods/sendMessage.ts +++ b/app/lib/methods/sendMessage.ts @@ -2,8 +2,8 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { Model } from '@nozbe/watermelondb'; import database from '../database'; -import log from '../../utils/log'; -import random from '../../utils/random'; +import log from './helpers/log'; +import { random } from './helpers'; import { Encryption } from '../encryption'; import { E2EType, IMessage, IUser, TMessageModel } from '../../definitions'; import sdk from '../services/sdk'; diff --git a/app/lib/methods/setUser.ts b/app/lib/methods/setUser.ts index 0dc836cde..da9b88fed 100644 --- a/app/lib/methods/setUser.ts +++ b/app/lib/methods/setUser.ts @@ -4,7 +4,7 @@ import { setActiveUsers } from '../../actions/activeUsers'; import { setUser } from '../../actions/login'; import { IUser } from '../../definitions'; import { store as reduxStore } from '../store/auxStore'; -import { compareServerVersion } from './helpers/compareServerVersion'; +import { compareServerVersion } from './helpers'; export interface IActiveUsers { [key: string]: { status: string; statusText?: string } | string | boolean; diff --git a/app/lib/methods/shareExtension.ts b/app/lib/methods/shareExtension.ts index 028748bce..f7ae6c073 100644 --- a/app/lib/methods/shareExtension.ts +++ b/app/lib/methods/shareExtension.ts @@ -1,8 +1,8 @@ import { Q } from '@nozbe/watermelondb'; import { shareSetSettings, shareSelectServer, shareSetUser } from '../../actions/share'; -import SSLPinning from '../../utils/sslPinning'; -import log from '../../utils/log'; +import SSLPinning from './helpers/sslPinning'; +import log from './helpers/log'; import { IShareServer, IShareUser } from '../../reducers/share'; import UserPreferences from './userPreferences'; import database from '../database'; diff --git a/app/lib/methods/subscribeRooms.ts b/app/lib/methods/subscribeRooms.ts index 8b8aab23d..7d8aafe0c 100644 --- a/app/lib/methods/subscribeRooms.ts +++ b/app/lib/methods/subscribeRooms.ts @@ -1,4 +1,4 @@ -import log from '../../utils/log'; +import log from './helpers/log'; import subscribeRoomsTmp, { roomsSubscription } from './subscriptions/rooms'; export async function subscribeRooms(): Promise { diff --git a/app/lib/methods/subscriptions/room.ts b/app/lib/methods/subscriptions/room.ts index aec12957b..11d333be3 100644 --- a/app/lib/methods/subscriptions/room.ts +++ b/app/lib/methods/subscriptions/room.ts @@ -2,7 +2,7 @@ import EJSON from 'ejson'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { InteractionManager } from 'react-native'; -import log from '../../../utils/log'; +import log from '../helpers/log'; import protectedFunction from '../helpers/protectedFunction'; import buildMessage from '../helpers/buildMessage'; import database from '../../database'; @@ -11,7 +11,7 @@ import { getThreadById } from '../../database/services/Thread'; import { getThreadMessageById } from '../../database/services/ThreadMessage'; import { store as reduxStore } from '../../store/auxStore'; import { addUserTyping, clearUserTyping, removeUserTyping } from '../../../actions/usersTyping'; -import debounce from '../../../utils/debounce'; +import { debounce } from '../helpers'; import { subscribeRoom, unsubscribeRoom } from '../../../actions/room'; import { Encryption } from '../../encryption'; import { IMessage, TMessageModel, TSubscriptionModel, TThreadMessageModel, TThreadModel } from '../../../definitions'; diff --git a/app/lib/methods/subscriptions/rooms.ts b/app/lib/methods/subscriptions/rooms.ts index 64ca5eb43..1c9a9e654 100644 --- a/app/lib/methods/subscriptions/rooms.ts +++ b/app/lib/methods/subscriptions/rooms.ts @@ -4,14 +4,12 @@ import EJSON from 'ejson'; import Model from '@nozbe/watermelondb/Model'; import database from '../../database'; -import { merge } from '../helpers/mergeSubscriptionsRooms'; import protectedFunction from '../helpers/protectedFunction'; -import log from '../../../utils/log'; -import random from '../../../utils/random'; +import log from '../helpers/log'; import { store } from '../../store/auxStore'; import { handlePayloadUserInteraction } from '../actions'; import buildMessage from '../helpers/buildMessage'; -import EventEmitter from '../../../utils/events'; +import EventEmitter from '../helpers/events'; import { removedRoom } from '../../../actions/room'; import { setUser } from '../../../actions/login'; import { INAPP_NOTIFICATION_EMITTER } from '../../../containers/InAppNotification'; @@ -34,7 +32,8 @@ import { getSubscriptionByRoomId } from '../../database/services/Subscription'; import { getMessageById } from '../../database/services/Message'; import { E2E_MESSAGE_TYPE } from '../../constants'; import { getRoom } from '../getRoom'; -import { getRoomAvatar, getRoomTitle, getSenderName } from '../helpers'; +import { merge } from '../helpers/mergeSubscriptionsRooms'; +import { getRoomAvatar, getRoomTitle, getSenderName, random } from '../helpers'; const removeListener = (listener: { stop: () => void }) => listener.stop(); diff --git a/app/lib/notifications/push.ts b/app/lib/notifications/push.ts index 32b016b1a..4da3c1a62 100644 --- a/app/lib/notifications/push.ts +++ b/app/lib/notifications/push.ts @@ -8,8 +8,8 @@ import { NotificationCategory } from 'react-native-notifications'; -import { INotification } from '../../definitions/INotification'; -import { isIOS } from '../../utils/deviceInfo'; +import { INotification } from '../../definitions'; +import { isIOS } from '../methods/helpers'; import { store as reduxStore } from '../store/auxStore'; import I18n from '../../i18n'; diff --git a/app/lib/services/connect.ts b/app/lib/services/connect.ts index caca9caaa..bdecc4aa1 100644 --- a/app/lib/services/connect.ts +++ b/app/lib/services/connect.ts @@ -4,27 +4,24 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { InteractionManager } from 'react-native'; import { Q } from '@nozbe/watermelondb'; -import log from '../../utils/log'; +import log from '../methods/helpers/log'; import { setActiveUsers } from '../../actions/activeUsers'; import protectedFunction from '../methods/helpers/protectedFunction'; import database from '../database'; import { selectServerFailure } from '../../actions/server'; -import { twoFactor } from '../../utils/twoFactor'; +import { twoFactor } from './twoFactor'; import { store } from '../store/auxStore'; import { loginRequest, setLoginServices, setUser } from '../../actions/login'; import sdk from './sdk'; import I18n from '../../i18n'; import { ICredentials, ILoggedUser, STATUSES } from '../../definitions'; -import { isIOS } from '../../utils/deviceInfo'; import { connectRequest, connectSuccess, disconnect as disconnectAction } from '../../actions/connect'; import { updatePermission } from '../../actions/permissions'; -import EventEmitter from '../../utils/events'; +import EventEmitter from '../methods/helpers/events'; import { updateSettings } from '../../actions/settings'; import { defaultSettings, MIN_ROCKETCHAT_VERSION } from '../constants'; -import { compareServerVersion } from '../methods/helpers/compareServerVersion'; -import { onRolesChanged } from '../methods/getRoles'; -import { isSsl } from '../../utils/url'; -import { getSettings, IActiveUsers, unsubscribeRooms, _activeUsers, _setUser, _setUserTimer } from '../methods'; +import { getSettings, IActiveUsers, unsubscribeRooms, _activeUsers, _setUser, _setUserTimer, onRolesChanged } from '../methods'; +import { compareServerVersion, isIOS, isSsl } from '../methods/helpers'; interface IServices { [index: string]: string | boolean; diff --git a/app/lib/services/restApi.ts b/app/lib/services/restApi.ts index 1e26271d9..8db113c07 100644 --- a/app/lib/services/restApi.ts +++ b/app/lib/services/restApi.ts @@ -15,10 +15,9 @@ import { Encryption } from '../encryption'; import { TParams } from '../../definitions/ILivechatEditView'; import { store as reduxStore } from '../store/auxStore'; import { getDeviceToken } from '../notifications'; -import { getBundleId, isIOS } from '../../utils/deviceInfo'; import { RoomTypes, roomTypeToApiType, unsubscribeRooms } from '../methods'; import sdk from './sdk'; -import { compareServerVersion } from '../methods/helpers/compareServerVersion'; +import { compareServerVersion, getBundleId, isIOS } from '../methods/helpers'; export const createChannel = ({ name, diff --git a/app/lib/services/sdk.ts b/app/lib/services/sdk.ts index 78aab00d7..05099c52a 100644 --- a/app/lib/services/sdk.ts +++ b/app/lib/services/sdk.ts @@ -2,8 +2,8 @@ import { Rocketchat } from '@rocket.chat/sdk'; import EJSON from 'ejson'; import isEmpty from 'lodash/isEmpty'; -import { twoFactor } from '../../utils/twoFactor'; -import { isSsl } from '../../utils/url'; +import { twoFactor } from './twoFactor'; +import { isSsl } from '../methods/helpers/url'; import { store as reduxStore } from '../store/auxStore'; import { Serialized, MatchPathPattern, OperationParams, PathFor, ResultFor } from '../../definitions/rest/helpers'; diff --git a/app/utils/twoFactor.ts b/app/lib/services/twoFactor.ts similarity index 84% rename from app/utils/twoFactor.ts rename to app/lib/services/twoFactor.ts index a52ff93fd..928bf8c3f 100644 --- a/app/utils/twoFactor.ts +++ b/app/lib/services/twoFactor.ts @@ -1,7 +1,7 @@ import { settings } from '@rocket.chat/sdk'; -import { TWO_FACTOR } from '../containers/TwoFactor'; -import EventEmitter from './events'; +import { TWO_FACTOR } from '../../containers/TwoFactor'; +import EventEmitter from '../methods/helpers/events'; interface ITwoFactor { method: string; diff --git a/app/sagas/createChannel.js b/app/sagas/createChannel.js index 444f442eb..a7b138862 100644 --- a/app/sagas/createChannel.js +++ b/app/sagas/createChannel.js @@ -3,12 +3,12 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { CREATE_CHANNEL, LOGIN } from '../actions/actionsTypes'; import { createChannelFailure, createChannelSuccess } from '../actions/createChannel'; -import { showErrorAlert } from '../utils/info'; +import { showErrorAlert } from '../lib/methods/helpers/info'; import Navigation from '../lib/navigation/appNavigation'; import database from '../lib/database'; import I18n from '../i18n'; -import { events, logEvent } from '../utils/log'; -import { goRoom } from '../utils/goRoom'; +import { events, logEvent } from '../lib/methods/helpers/log'; +import { goRoom } from '../lib/methods/helpers/goRoom'; import { Services } from '../lib/services'; const handleRequest = function* handleRequest({ data }) { diff --git a/app/sagas/createDiscussion.js b/app/sagas/createDiscussion.js index 9afccc7cf..f569833f5 100644 --- a/app/sagas/createDiscussion.js +++ b/app/sagas/createDiscussion.js @@ -4,7 +4,7 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { CREATE_DISCUSSION, LOGIN } from '../actions/actionsTypes'; import { createDiscussionFailure, createDiscussionSuccess } from '../actions/createDiscussion'; import database from '../lib/database'; -import { events, logEvent } from '../utils/log'; +import { events, logEvent } from '../lib/methods/helpers/log'; import { Services } from '../lib/services'; const handleRequest = function* handleRequest({ data }) { diff --git a/app/sagas/deepLinking.js b/app/sagas/deepLinking.js index bb545bef7..47093d164 100644 --- a/app/sagas/deepLinking.js +++ b/app/sagas/deepLinking.js @@ -6,15 +6,16 @@ import * as types from '../actions/actionsTypes'; import { selectServerRequest, serverInitAdd } from '../actions/server'; import { inviteLinksRequest, inviteLinksSetToken } from '../actions/inviteLinks'; import database from '../lib/database'; -import EventEmitter from '../utils/events'; +import EventEmitter from '../lib/methods/helpers/events'; import { appInit, appStart } from '../actions/app'; -import { localAuthenticate } from '../utils/localAuthentication'; -import { goRoom } from '../utils/goRoom'; +import { localAuthenticate } from '../lib/methods/helpers/localAuthentication'; +import { goRoom } from '../lib/methods/helpers/goRoom'; +import { getUidDirectMessage } from '../lib/methods/helpers'; import { loginRequest } from '../actions/login'; -import log from '../utils/log'; +import log from '../lib/methods/helpers/log'; import { RootEnum } from '../definitions'; import { CURRENT_SERVER, TOKEN_KEY } from '../lib/constants'; -import { callJitsi, callJitsiWithoutServer, canOpenRoom, getUidDirectMessage } from '../lib/methods'; +import { callJitsi, callJitsiWithoutServer, canOpenRoom } from '../lib/methods'; import { Services } from '../lib/services'; const roomTypes = { diff --git a/app/sagas/encryption.js b/app/sagas/encryption.js index f0d7f994e..fb94930f0 100644 --- a/app/sagas/encryption.js +++ b/app/sagas/encryption.js @@ -8,9 +8,9 @@ import Navigation from '../lib/navigation/appNavigation'; import database from '../lib/database'; import UserPreferences from '../lib/methods/userPreferences'; import { getUserSelector } from '../selectors/login'; -import { showErrorAlert } from '../utils/info'; +import { showErrorAlert } from '../lib/methods/helpers/info'; import I18n from '../i18n'; -import log from '../utils/log'; +import log from '../lib/methods/helpers/log'; import { E2E_BANNER_TYPE, E2E_PRIVATE_KEY, E2E_PUBLIC_KEY, E2E_RANDOM_PASSWORD_KEY } from '../lib/constants'; import { Services } from '../lib/services'; diff --git a/app/sagas/init.js b/app/sagas/init.js index 9c2f8619f..1e6f787ce 100644 --- a/app/sagas/init.js +++ b/app/sagas/init.js @@ -6,9 +6,9 @@ import UserPreferences from '../lib/methods/userPreferences'; import { selectServerRequest } from '../actions/server'; import { setAllPreferences } from '../actions/sortPreferences'; import { APP } from '../actions/actionsTypes'; -import log from '../utils/log'; +import log from '../lib/methods/helpers/log'; import database from '../lib/database'; -import { localAuthenticate } from '../utils/localAuthentication'; +import { localAuthenticate } from '../lib/methods/helpers/localAuthentication'; import { appReady, appStart } from '../actions/app'; import { RootEnum } from '../definitions'; import { getSortPreferences } from '../lib/methods'; diff --git a/app/sagas/inviteLinks.js b/app/sagas/inviteLinks.js index e9bee9d28..d6f149c38 100644 --- a/app/sagas/inviteLinks.js +++ b/app/sagas/inviteLinks.js @@ -3,10 +3,10 @@ import { Alert } from 'react-native'; import { INVITE_LINKS } from '../actions/actionsTypes'; import { inviteLinksFailure, inviteLinksSetInvite, inviteLinksSuccess } from '../actions/inviteLinks'; -import log from '../utils/log'; +import log from '../lib/methods/helpers/log'; import Navigation from '../lib/navigation/appNavigation'; import I18n from '../i18n'; -import { getRoomTitle } from '../lib/methods'; +import { getRoomTitle } from '../lib/methods/helpers'; import { Services } from '../lib/services'; const handleRequest = function* handleRequest({ token }) { diff --git a/app/sagas/login.js b/app/sagas/login.js index 1d11d98a3..c4b435bc4 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -7,13 +7,13 @@ import { appStart } from '../actions/app'; import { selectServerRequest, serverFinishAdd } from '../actions/server'; import { loginFailure, loginSuccess, logout as logoutAction, setUser } from '../actions/login'; import { roomsRequest } from '../actions/rooms'; -import log, { events, logEvent } from '../utils/log'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; import I18n, { setLanguage } from '../i18n'; import database from '../lib/database'; -import EventEmitter from '../utils/events'; +import EventEmitter from '../lib/methods/helpers/events'; import { inviteLinksRequest } from '../actions/inviteLinks'; -import { showErrorAlert } from '../utils/info'; -import { localAuthenticate } from '../utils/localAuthentication'; +import { showErrorAlert } from '../lib/methods/helpers/info'; +import { localAuthenticate } from '../lib/methods/helpers/localAuthentication'; import { encryptionInit, encryptionStop } from '../actions/encryption'; import UserPreferences from '../lib/methods/userPreferences'; import { inquiryRequest, inquiryReset } from '../ee/omnichannel/actions/inquiry'; diff --git a/app/sagas/messages.js b/app/sagas/messages.js index bf2ea1275..6940f2409 100644 --- a/app/sagas/messages.js +++ b/app/sagas/messages.js @@ -4,8 +4,8 @@ import { Q } from '@nozbe/watermelondb'; import Navigation from '../lib/navigation/appNavigation'; import { MESSAGES } from '../actions/actionsTypes'; import database from '../lib/database'; -import log from '../utils/log'; -import { goRoom } from '../utils/goRoom'; +import log from '../lib/methods/helpers/log'; +import { goRoom } from '../lib/methods/helpers/goRoom'; import { Services } from '../lib/services'; const handleReplyBroadcast = function* handleReplyBroadcast({ message }) { diff --git a/app/sagas/room.js b/app/sagas/room.js index b25bb2a30..9556c4114 100644 --- a/app/sagas/room.js +++ b/app/sagas/room.js @@ -2,13 +2,13 @@ import { Alert } from 'react-native'; import prompt from 'react-native-prompt-android'; import { delay, put, race, select, take, takeLatest } from 'redux-saga/effects'; -import EventEmitter from '../utils/events'; +import EventEmitter from '../lib/methods/helpers/events'; import Navigation from '../lib/navigation/appNavigation'; import * as types from '../actions/actionsTypes'; import { removedRoom } from '../actions/room'; -import log, { events, logEvent } from '../utils/log'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; import I18n from '../i18n'; -import { showErrorAlert } from '../utils/info'; +import { showErrorAlert } from '../lib/methods/helpers/info'; import { LISTENER } from '../containers/Toast'; import { Services } from '../lib/services'; diff --git a/app/sagas/rooms.js b/app/sagas/rooms.js index ffe1a4a8c..156c5607e 100644 --- a/app/sagas/rooms.js +++ b/app/sagas/rooms.js @@ -5,7 +5,7 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import * as types from '../actions/actionsTypes'; import { roomsFailure, roomsRefresh, roomsSuccess } from '../actions/rooms'; import database from '../lib/database'; -import log from '../utils/log'; +import log from '../lib/methods/helpers/log'; import mergeSubscriptionsRooms from '../lib/methods/helpers/mergeSubscriptionsRooms'; import buildMessage from '../lib/methods/helpers/buildMessage'; import { getRooms, subscribeRooms } from '../lib/methods'; diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index 8dcdf4894..b6669db01 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -12,13 +12,13 @@ import { clearSettings } from '../actions/settings'; import { clearUser, setUser } from '../actions/login'; import { clearActiveUsers } from '../actions/activeUsers'; import database from '../lib/database'; -import log, { logServerVersion } from '../utils/log'; +import log, { logServerVersion } from '../lib/methods/helpers/log'; import I18n from '../i18n'; -import { BASIC_AUTH_KEY, setBasicAuth } from '../utils/fetch'; +import { BASIC_AUTH_KEY, setBasicAuth } from '../lib/methods/helpers/fetch'; import { appStart } from '../actions/app'; import UserPreferences from '../lib/methods/userPreferences'; import { encryptionStop } from '../actions/encryption'; -import SSLPinning from '../utils/sslPinning'; +import SSLPinning from '../lib/methods/helpers/sslPinning'; import { inquiryReset } from '../ee/omnichannel/actions/inquiry'; import { RootEnum } from '../definitions'; import { CERTIFICATE_KEY, CURRENT_SERVER, TOKEN_KEY } from '../lib/constants'; diff --git a/app/sagas/state.js b/app/sagas/state.js index a5d31e2e2..b29b2645a 100644 --- a/app/sagas/state.js +++ b/app/sagas/state.js @@ -1,7 +1,7 @@ import { select, takeLatest } from 'redux-saga/effects'; -import log from '../utils/log'; -import { localAuthenticate, saveLastLocalAuthenticationSession } from '../utils/localAuthentication'; +import log from '../lib/methods/helpers/log'; +import { localAuthenticate, saveLastLocalAuthenticationSession } from '../lib/methods/helpers/localAuthentication'; import { APP_STATE } from '../actions/actionsTypes'; import { RootEnum } from '../definitions'; import { Services } from '../lib/services'; diff --git a/app/share.tsx b/app/share.tsx index 2a241b76d..089181483 100644 --- a/app/share.tsx +++ b/app/share.tsx @@ -5,15 +5,15 @@ import { AppearanceProvider } from 'react-native-appearance'; import { createStackNavigator } from '@react-navigation/stack'; import { Provider } from 'react-redux'; -import { getTheme, initialTheme, newThemeState, subscribeTheme, unsubscribeTheme } from './utils/theme'; +import { getTheme, initialTheme, newThemeState, subscribeTheme, unsubscribeTheme } from './lib/methods/helpers/theme'; import UserPreferences from './lib/methods/userPreferences'; import Navigation from './lib/navigation/shareNavigation'; import store from './lib/store'; import { initStore } from './lib/store/auxStore'; import { closeShareExtension, shareExtensionInit } from './lib/methods/shareExtension'; -import { defaultHeader, getActiveRouteName, navigationTheme, themedHeader } from './utils/navigation'; +import { defaultHeader, getActiveRouteName, navigationTheme, themedHeader } from './lib/methods/helpers/navigation'; import { ThemeContext, TSupportedThemes } from './theme'; -import { localAuthenticate } from './utils/localAuthentication'; +import { localAuthenticate } from './lib/methods/helpers/localAuthentication'; import { IThemePreference } from './definitions/ITheme'; import ScreenLockedView from './views/ScreenLockedView'; // Outside Stack @@ -22,10 +22,10 @@ import WithoutServersView from './views/WithoutServersView'; import ShareListView from './views/ShareListView'; import ShareView from './views/ShareView'; import SelectServerView from './views/SelectServerView'; -import { setCurrentScreen } from './utils/log'; +import { setCurrentScreen } from './lib/methods/helpers/log'; import AuthLoadingView from './views/AuthLoadingView'; import { DimensionsContext } from './dimensions'; -import debounce from './utils/debounce'; +import { debounce } from './lib/methods/helpers'; import { ShareInsideStackParamList, ShareOutsideStackParamList, ShareAppStackParamList } from './definitions/navigationTypes'; import { colors, CURRENT_SERVER } from './lib/constants'; diff --git a/app/stacks/InsideStack.tsx b/app/stacks/InsideStack.tsx index d15b7aa2a..e51303749 100644 --- a/app/stacks/InsideStack.tsx +++ b/app/stacks/InsideStack.tsx @@ -4,7 +4,7 @@ import { createStackNavigator, StackNavigationOptions } from '@react-navigation/ import { createDrawerNavigator } from '@react-navigation/drawer'; import { ThemeContext } from '../theme'; -import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../utils/navigation'; +import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../lib/methods/helpers/navigation'; import Sidebar from '../views/SidebarView'; // Chats Stack import RoomView from '../views/RoomView'; diff --git a/app/stacks/MasterDetailStack/index.tsx b/app/stacks/MasterDetailStack/index.tsx index 2168bcfa0..2551f6ec8 100644 --- a/app/stacks/MasterDetailStack/index.tsx +++ b/app/stacks/MasterDetailStack/index.tsx @@ -4,7 +4,13 @@ import { createStackNavigator, StackNavigationOptions, StackNavigationProp } fro import { createDrawerNavigator } from '@react-navigation/drawer'; import { ThemeContext } from '../../theme'; -import { FadeFromCenterModal, StackAnimation, defaultHeader, themedHeader, drawerStyle } from '../../utils/navigation'; +import { + FadeFromCenterModal, + StackAnimation, + defaultHeader, + themedHeader, + drawerStyle +} from '../../lib/methods/helpers/navigation'; // Chats Stack import RoomView from '../../views/RoomView'; import RoomsListView from '../../views/RoomsListView'; diff --git a/app/stacks/OutsideStack.tsx b/app/stacks/OutsideStack.tsx index 87cb80ac0..c44d1268b 100644 --- a/app/stacks/OutsideStack.tsx +++ b/app/stacks/OutsideStack.tsx @@ -3,7 +3,7 @@ import { createStackNavigator, StackNavigationOptions } from '@react-navigation/ import { connect } from 'react-redux'; import { ThemeContext } from '../theme'; -import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../utils/navigation'; +import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../lib/methods/helpers/navigation'; // Outside Stack import NewServerView from '../views/NewServerView'; import WorkspaceView from '../views/WorkspaceView'; diff --git a/app/views/AddExistingChannelView.tsx b/app/views/AddExistingChannelView.tsx index a666bd255..4e26376aa 100644 --- a/app/views/AddExistingChannelView.tsx +++ b/app/views/AddExistingChannelView.tsx @@ -8,7 +8,7 @@ import { Q } from '@nozbe/watermelondb'; import * as List from '../containers/List'; import database from '../lib/database'; import I18n from '../i18n'; -import log, { events, logEvent } from '../utils/log'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; import SearchBox from '../containers/SearchBox'; import * as HeaderButton from '../containers/HeaderButton'; import StatusBar from '../containers/StatusBar'; @@ -16,13 +16,12 @@ import { themes } from '../lib/constants'; import { TSupportedThemes, withTheme } from '../theme'; import SafeAreaView from '../containers/SafeAreaView'; import Loading from '../containers/Loading'; -import { animateNextTransition } from '../utils/layoutAnimation'; -import { goRoom } from '../utils/goRoom'; -import { showErrorAlert } from '../utils/info'; -import debounce from '../utils/debounce'; +import { animateNextTransition } from '../lib/methods/helpers/layoutAnimation'; +import { goRoom } from '../lib/methods/helpers/goRoom'; +import { showErrorAlert } from '../lib/methods/helpers/info'; import { ChatsStackParamList } from '../stacks/types'; import { TSubscriptionModel, SubscriptionType, IApplicationState } from '../definitions'; -import { getRoomTitle, hasPermission } from '../lib/methods'; +import { getRoomTitle, hasPermission, debounce } from '../lib/methods/helpers'; import { Services } from '../lib/services'; interface IAddExistingChannelViewState { diff --git a/app/views/AttachmentView.tsx b/app/views/AttachmentView.tsx index d6e0a669b..b8bfcdb9e 100644 --- a/app/views/AttachmentView.tsx +++ b/app/views/AttachmentView.tsx @@ -11,22 +11,20 @@ import { sha256 } from 'js-sha256'; import { withSafeAreaInsets } from 'react-native-safe-area-context'; import { LISTENER } from '../containers/Toast'; -import EventEmitter from '../utils/events'; +import EventEmitter from '../lib/methods/helpers/events'; import I18n from '../i18n'; import { TSupportedThemes, withTheme } from '../theme'; import { ImageViewer } from '../presentation/ImageViewer'; import { themes } from '../lib/constants'; import RCActivityIndicator from '../containers/ActivityIndicator'; import * as HeaderButton from '../containers/HeaderButton'; -import { isAndroid } from '../utils/deviceInfo'; +import { isAndroid, formatAttachmentUrl } from '../lib/methods/helpers'; import { getUserSelector } from '../selectors/login'; import { withDimensions } from '../dimensions'; import { getHeaderHeight } from '../containers/Header'; import StatusBar from '../containers/StatusBar'; import { InsideStackParamList } from '../stacks/types'; -import { IAttachment } from '../definitions/IAttachment'; -import { formatAttachmentUrl } from '../lib/methods/helpers/formatAttachmentUrl'; -import { IApplicationState, IUser } from '../definitions'; +import { IApplicationState, IUser, IAttachment } from '../definitions'; const styles = StyleSheet.create({ container: { diff --git a/app/views/AuthenticationWebView.tsx b/app/views/AuthenticationWebView.tsx index ee2590050..5b0d7f3f2 100644 --- a/app/views/AuthenticationWebView.tsx +++ b/app/views/AuthenticationWebView.tsx @@ -7,11 +7,10 @@ import { WebViewMessage } from 'react-native-webview/lib/WebViewTypes'; import { RouteProp } from '@react-navigation/core'; import { OutsideModalParamList } from '../stacks/types'; -import { isIOS } from '../utils/deviceInfo'; import StatusBar from '../containers/StatusBar'; import ActivityIndicator from '../containers/ActivityIndicator'; import { TSupportedThemes, withTheme } from '../theme'; -import debounce from '../utils/debounce'; +import { debounce, isIOS } from '../lib/methods/helpers'; import * as HeaderButton from '../containers/HeaderButton'; import { Services } from '../lib/services'; import { IApplicationState, ICredentials } from '../definitions'; diff --git a/app/views/AutoTranslateView/index.tsx b/app/views/AutoTranslateView/index.tsx index b01a21ecf..523c63da5 100644 --- a/app/views/AutoTranslateView/index.tsx +++ b/app/views/AutoTranslateView/index.tsx @@ -9,7 +9,7 @@ import * as List from '../../containers/List'; import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants'; import { withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; -import { events, logEvent } from '../../utils/log'; +import { events, logEvent } from '../../lib/methods/helpers/log'; import { IBaseScreen, ISubscription } from '../../definitions'; import { Services } from '../../lib/services'; diff --git a/app/views/CannedResponseDetail.tsx b/app/views/CannedResponseDetail.tsx index e5b0c561b..fb84f2f83 100644 --- a/app/views/CannedResponseDetail.tsx +++ b/app/views/CannedResponseDetail.tsx @@ -9,13 +9,13 @@ import StatusBar from '../containers/StatusBar'; import Button from '../containers/Button'; import { TSupportedThemes, useTheme } from '../theme'; import Navigation from '../lib/navigation/appNavigation'; -import { goRoom } from '../utils/goRoom'; +import { goRoom } from '../lib/methods/helpers/goRoom'; import { themes } from '../lib/constants'; import Markdown from '../containers/markdown'; import { ICannedResponse } from '../definitions/ICannedResponse'; import { ChatsStackParamList } from '../stacks/types'; import sharedStyles from './Styles'; -import { getRoomTitle, getUidDirectMessage } from '../lib/methods'; +import { getRoomTitle, getUidDirectMessage } from '../lib/methods/helpers'; import { useAppSelector } from '../lib/hooks'; const styles = StyleSheet.create({ diff --git a/app/views/CannedResponsesListView/Dropdown/DropdownItem.tsx b/app/views/CannedResponsesListView/Dropdown/DropdownItem.tsx index 84c14ebc5..354022431 100644 --- a/app/views/CannedResponsesListView/Dropdown/DropdownItem.tsx +++ b/app/views/CannedResponsesListView/Dropdown/DropdownItem.tsx @@ -3,7 +3,7 @@ import { StyleSheet, Text, View } from 'react-native'; import { themes } from '../../../lib/constants'; import { useTheme } from '../../../theme'; -import Touch from '../../../utils/touch'; +import Touch from '../../../lib/methods/helpers/touch'; import { CustomIcon, TIconsName } from '../../../containers/CustomIcon'; import sharedStyles from '../../Styles'; diff --git a/app/views/CannedResponsesListView/index.tsx b/app/views/CannedResponsesListView/index.tsx index 693970296..b898a5fe1 100644 --- a/app/views/CannedResponsesListView/index.tsx +++ b/app/views/CannedResponsesListView/index.tsx @@ -14,24 +14,23 @@ import SearchHeader from '../../containers/SearchHeader'; import BackgroundContainer from '../../containers/BackgroundContainer'; import { getHeaderTitlePosition } from '../../containers/Header'; import { useTheme } from '../../theme'; -import debounce from '../../utils/debounce'; import Navigation from '../../lib/navigation/appNavigation'; -import { goRoom } from '../../utils/goRoom'; +import { goRoom } from '../../lib/methods/helpers/goRoom'; import * as HeaderButton from '../../containers/HeaderButton'; import * as List from '../../containers/List'; import { themes } from '../../lib/constants'; -import log from '../../utils/log'; +import log from '../../lib/methods/helpers/log'; import CannedResponseItem from './CannedResponseItem'; import Dropdown from './Dropdown'; import DropdownItemHeader from './Dropdown/DropdownItemHeader'; import styles from './styles'; import { ICannedResponse } from '../../definitions/ICannedResponse'; import { ChatsStackParamList } from '../../stacks/types'; -import { ISubscription } from '../../definitions/ISubscription'; -import { getRoomTitle, getUidDirectMessage } from '../../lib/methods'; +import { getRoomTitle, getUidDirectMessage, debounce } from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; import { ILivechatDepartment } from '../../definitions/ILivechatDepartment'; import { useAppSelector } from '../../lib/hooks'; +import { ISubscription } from '../../definitions'; const COUNT = 25; diff --git a/app/views/ChangePasscodeView.tsx b/app/views/ChangePasscodeView.tsx index 386ea6720..1dda46631 100644 --- a/app/views/ChangePasscodeView.tsx +++ b/app/views/ChangePasscodeView.tsx @@ -7,9 +7,9 @@ import Modal from 'react-native-modal'; import Touchable from 'react-native-platform-touchable'; import { useTheme } from '../theme'; -import { hasNotch, isTablet } from '../utils/deviceInfo'; +import { hasNotch, isTablet } from '../lib/methods/helpers'; import { PasscodeChoose } from '../containers/Passcode'; -import EventEmitter from '../utils/events'; +import EventEmitter from '../lib/methods/helpers/events'; import { CustomIcon } from '../containers/CustomIcon'; import { CHANGE_PASSCODE_EMITTER, themes } from '../lib/constants'; diff --git a/app/views/CreateChannelView.tsx b/app/views/CreateChannelView.tsx index 989d0fb98..f31cd86c8 100644 --- a/app/views/CreateChannelView.tsx +++ b/app/views/CreateChannelView.tsx @@ -9,21 +9,21 @@ import Loading from '../containers/Loading'; import { createChannelRequest } from '../actions/createChannel'; import { removeUser } from '../actions/selectedUsers'; import KeyboardView from '../containers/KeyboardView'; -import scrollPersistTaps from '../utils/scrollPersistTaps'; +import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; import I18n from '../i18n'; import UserItem from '../containers/UserItem'; import * as HeaderButton from '../containers/HeaderButton'; import StatusBar from '../containers/StatusBar'; import { SWITCH_TRACK_COLOR, themes } from '../lib/constants'; import { withTheme } from '../theme'; -import { Review } from '../utils/review'; +import { Review } from '../lib/methods/helpers/review'; import { getUserSelector } from '../selectors/login'; -import { events, logEvent } from '../utils/log'; +import { events, logEvent } from '../lib/methods/helpers/log'; import SafeAreaView from '../containers/SafeAreaView'; import sharedStyles from './Styles'; import { ChatsStackParamList } from '../stacks/types'; import { IApplicationState, IBaseScreen, IUser } from '../definitions'; -import { hasPermission } from '../lib/methods'; +import { hasPermission } from '../lib/methods/helpers'; const styles = StyleSheet.create({ container: { diff --git a/app/views/CreateDiscussionView/SelectChannel.tsx b/app/views/CreateDiscussionView/SelectChannel.tsx index ef11604c3..f96562fa7 100644 --- a/app/views/CreateDiscussionView/SelectChannel.tsx +++ b/app/views/CreateDiscussionView/SelectChannel.tsx @@ -5,11 +5,11 @@ import { themes } from '../../lib/constants'; import { MultiSelect } from '../../containers/UIKit/MultiSelect'; import { ISearchLocal } from '../../definitions'; import I18n from '../../i18n'; -import { avatarURL } from '../../utils/avatar'; -import debounce from '../../utils/debounce'; +import { getAvatarURL } from '../../lib/methods/helpers/getAvatarUrl'; import { ICreateDiscussionViewSelectChannel } from './interfaces'; import styles from './styles'; -import { getRoomAvatar, getRoomTitle, localSearch } from '../../lib/methods'; +import { localSearch } from '../../lib/methods'; +import { getRoomAvatar, getRoomTitle, debounce } from '../../lib/methods/helpers'; const SelectChannel = ({ server, @@ -33,7 +33,7 @@ const SelectChannel = ({ }, 300); const getAvatar = (item: ISearchLocal) => - avatarURL({ + getAvatarURL({ text: getRoomAvatar(item), type: item.t, user: { id: userId, token }, diff --git a/app/views/CreateDiscussionView/SelectUsers.tsx b/app/views/CreateDiscussionView/SelectUsers.tsx index 0e662e20b..a58410f76 100644 --- a/app/views/CreateDiscussionView/SelectUsers.tsx +++ b/app/views/CreateDiscussionView/SelectUsers.tsx @@ -2,15 +2,15 @@ import React, { useState } from 'react'; import { Text } from 'react-native'; import { BlockContext } from '@rocket.chat/ui-kit'; -import debounce from '../../utils/debounce'; -import { avatarURL } from '../../utils/avatar'; +import { getAvatarURL } from '../../lib/methods/helpers/getAvatarUrl'; import I18n from '../../i18n'; import { MultiSelect } from '../../containers/UIKit/MultiSelect'; import { themes } from '../../lib/constants'; import styles from './styles'; import { ICreateDiscussionViewSelectUsers } from './interfaces'; import { SubscriptionType, IUser } from '../../definitions'; -import { getRoomAvatar, getRoomTitle, search } from '../../lib/methods'; +import { search } from '../../lib/methods'; +import { getRoomAvatar, getRoomTitle, debounce } from '../../lib/methods/helpers'; const SelectUsers = ({ server, @@ -37,7 +37,7 @@ const SelectUsers = ({ }, 300); const getAvatar = (item: IUser) => - avatarURL({ + getAvatarURL({ text: getRoomAvatar(item), type: SubscriptionType.DIRECT, user: { id: userId, token }, diff --git a/app/views/CreateDiscussionView/index.tsx b/app/views/CreateDiscussionView/index.tsx index c4beb1952..89580aa90 100644 --- a/app/views/CreateDiscussionView/index.tsx +++ b/app/views/CreateDiscussionView/index.tsx @@ -5,7 +5,7 @@ import { StackNavigationOptions } from '@react-navigation/stack'; import Loading from '../../containers/Loading'; import KeyboardView from '../../containers/KeyboardView'; -import scrollPersistTaps from '../../utils/scrollPersistTaps'; +import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps'; import I18n from '../../i18n'; import * as HeaderButton from '../../containers/HeaderButton'; import StatusBar from '../../containers/StatusBar'; @@ -14,17 +14,17 @@ import { getUserSelector } from '../../selectors/login'; import FormTextInput from '../../containers/TextInput/FormTextInput'; import Navigation from '../../lib/navigation/appNavigation'; import { createDiscussionRequest, ICreateDiscussionRequestData } from '../../actions/createDiscussion'; -import { showErrorAlert } from '../../utils/info'; +import { showErrorAlert } from '../../lib/methods/helpers/info'; import SafeAreaView from '../../containers/SafeAreaView'; -import { goRoom } from '../../utils/goRoom'; -import { events, logEvent } from '../../utils/log'; +import { goRoom } from '../../lib/methods/helpers/goRoom'; +import { events, logEvent } from '../../lib/methods/helpers/log'; import styles from './styles'; import SelectUsers from './SelectUsers'; import SelectChannel from './SelectChannel'; import { ICreateChannelViewProps, IResult, IError, ICreateChannelViewState } from './interfaces'; import { IApplicationState, ISearchLocal, ISubscription } from '../../definitions'; import { E2E_ROOM_TYPES, SWITCH_TRACK_COLOR, themes } from '../../lib/constants'; -import { getRoomTitle } from '../../lib/methods'; +import { getRoomTitle } from '../../lib/methods/helpers'; class CreateChannelView extends React.Component { private channel: ISubscription; diff --git a/app/views/DefaultBrowserView.tsx b/app/views/DefaultBrowserView.tsx index a2d369922..a62da19ca 100644 --- a/app/views/DefaultBrowserView.tsx +++ b/app/views/DefaultBrowserView.tsx @@ -9,11 +9,11 @@ import { withTheme } from '../theme'; import { themes } from '../lib/constants'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; -import { DEFAULT_BROWSER_KEY } from '../utils/openLink'; -import { isIOS } from '../utils/deviceInfo'; +import { DEFAULT_BROWSER_KEY } from '../lib/methods/helpers/openLink'; +import { isIOS } from '../lib/methods/helpers'; import SafeAreaView from '../containers/SafeAreaView'; import UserPreferences from '../lib/methods/userPreferences'; -import { events, logEvent } from '../utils/log'; +import { events, logEvent } from '../lib/methods/helpers/log'; type TValue = 'inApp' | 'systemDefault:' | 'googlechrome:' | 'firefox:' | 'brave:'; diff --git a/app/views/DirectoryView/Options.tsx b/app/views/DirectoryView/Options.tsx index c1c59a5d3..ea4502b86 100644 --- a/app/views/DirectoryView/Options.tsx +++ b/app/views/DirectoryView/Options.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import { Animated, Easing, Switch, Text, TouchableWithoutFeedback, View } from 'react-native'; -import Touch from '../../utils/touch'; +import Touch from '../../lib/methods/helpers/touch'; import { CustomIcon, TIconsName } from '../../containers/CustomIcon'; import Check from '../../containers/Check'; import I18n from '../../i18n'; diff --git a/app/views/DirectoryView/index.tsx b/app/views/DirectoryView/index.tsx index e186cea62..30e8cac6c 100644 --- a/app/views/DirectoryView/index.tsx +++ b/app/views/DirectoryView/index.tsx @@ -7,7 +7,7 @@ import { CompositeNavigationProp } from '@react-navigation/native'; import { ChatsStackParamList } from '../../stacks/types'; import { MasterDetailInsideStackParamList } from '../../stacks/MasterDetailStack/types'; import * as List from '../../containers/List'; -import Touch from '../../utils/touch'; +import Touch from '../../lib/methods/helpers/touch'; import DirectoryItem from '../../containers/DirectoryItem'; import sharedStyles from '../Styles'; import I18n from '../../i18n'; @@ -16,13 +16,13 @@ import { CustomIcon, TIconsName } from '../../containers/CustomIcon'; import StatusBar from '../../containers/StatusBar'; import ActivityIndicator from '../../containers/ActivityIndicator'; import * as HeaderButton from '../../containers/HeaderButton'; -import debounce from '../../utils/debounce'; -import log, { events, logEvent } from '../../utils/log'; +import { debounce } from '../../lib/methods/helpers'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; import { TSupportedThemes, withTheme } from '../../theme'; import { themes } from '../../lib/constants'; import { getUserSelector } from '../../selectors/login'; import SafeAreaView from '../../containers/SafeAreaView'; -import { goRoom, TGoRoomItem } from '../../utils/goRoom'; +import { goRoom, TGoRoomItem } from '../../lib/methods/helpers/goRoom'; import { IApplicationState, IServerRoom, IUser, SubscriptionType } from '../../definitions'; import styles from './styles'; import Options from './Options'; diff --git a/app/views/DiscussionsView/Item.tsx b/app/views/DiscussionsView/Item.tsx index aa1a0b46b..7d18b7f69 100644 --- a/app/views/DiscussionsView/Item.tsx +++ b/app/views/DiscussionsView/Item.tsx @@ -7,7 +7,7 @@ import { useTheme } from '../../theme'; import Avatar from '../../containers/Avatar'; import sharedStyles from '../Styles'; import { MarkdownPreview } from '../../containers/markdown'; -import { formatDateThreads, makeThreadName } from '../../utils/room'; +import { formatDateThreads, makeThreadName } from '../../lib/methods/helpers/room'; import DiscussionDetails from './DiscussionDetails'; import { IMessageFromServer } from '../../definitions'; diff --git a/app/views/DiscussionsView/index.tsx b/app/views/DiscussionsView/index.tsx index d0da4c78f..d0f1a5031 100644 --- a/app/views/DiscussionsView/index.tsx +++ b/app/views/DiscussionsView/index.tsx @@ -10,13 +10,12 @@ import { ChatsStackParamList } from '../../stacks/types'; import ActivityIndicator from '../../containers/ActivityIndicator'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; -import log from '../../utils/log'; -import debounce from '../../utils/debounce'; +import log from '../../lib/methods/helpers/log'; +import { debounce, isIOS } from '../../lib/methods/helpers'; import SafeAreaView from '../../containers/SafeAreaView'; import * as HeaderButton from '../../containers/HeaderButton'; import * as List from '../../containers/List'; import BackgroundContainer from '../../containers/BackgroundContainer'; -import { isIOS } from '../../utils/deviceInfo'; import { getHeaderTitlePosition } from '../../containers/Header'; import { useTheme } from '../../theme'; import SearchHeader from '../../containers/SearchHeader'; diff --git a/app/views/DisplayPrefsView.tsx b/app/views/DisplayPrefsView.tsx index 085a368c7..f07bcc97a 100644 --- a/app/views/DisplayPrefsView.tsx +++ b/app/views/DisplayPrefsView.tsx @@ -16,7 +16,7 @@ import { IPreferences } from '../definitions'; import I18n from '../i18n'; import { SettingsStackParamList } from '../stacks/types'; import { useTheme } from '../theme'; -import { events, logEvent } from '../utils/log'; +import { events, logEvent } from '../lib/methods/helpers/log'; import { saveSortPreference } from '../lib/methods'; import { useAppSelector } from '../lib/hooks'; diff --git a/app/views/E2EEncryptionSecurityView.tsx b/app/views/E2EEncryptionSecurityView.tsx index dd7267254..bb48e8c27 100644 --- a/app/views/E2EEncryptionSecurityView.tsx +++ b/app/views/E2EEncryptionSecurityView.tsx @@ -6,7 +6,7 @@ import { connect } from 'react-redux'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; import I18n from '../i18n'; -import log, { events, logEvent } from '../utils/log'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; import { withTheme } from '../theme'; import SafeAreaView from '../containers/SafeAreaView'; import FormTextInput from '../containers/TextInput/FormTextInput'; @@ -16,10 +16,10 @@ import { PADDING_HORIZONTAL } from '../containers/List/constants'; import { themes } from '../lib/constants'; import { Encryption } from '../lib/encryption'; import { logout } from '../actions/login'; -import { showConfirmationAlert, showErrorAlert } from '../utils/info'; -import EventEmitter from '../utils/events'; +import { showConfirmationAlert, showErrorAlert } from '../lib/methods/helpers/info'; +import EventEmitter from '../lib/methods/helpers/events'; import { LISTENER } from '../containers/Toast'; -import debounce from '../utils/debounce'; +import { debounce } from '../lib/methods/helpers'; import sharedStyles from './Styles'; import { IApplicationState, IBaseScreen, IUser } from '../definitions'; import { Services } from '../lib/services'; diff --git a/app/views/E2EEnterYourPasswordView.tsx b/app/views/E2EEnterYourPasswordView.tsx index 5d3699bc1..431fb3a9d 100644 --- a/app/views/E2EEnterYourPasswordView.tsx +++ b/app/views/E2EEnterYourPasswordView.tsx @@ -15,8 +15,8 @@ import I18n from '../i18n'; import KeyboardView from '../containers/KeyboardView'; import { E2EEnterYourPasswordStackParamList } from '../stacks/types'; import { withTheme } from '../theme'; -import { events, logEvent } from '../utils/log'; -import scrollPersistTaps from '../utils/scrollPersistTaps'; +import { events, logEvent } from '../lib/methods/helpers/log'; +import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; import sharedStyles from './Styles'; const styles = StyleSheet.create({ diff --git a/app/views/E2ESaveYourPasswordView.tsx b/app/views/E2ESaveYourPasswordView.tsx index 85518eed7..865a7cc43 100644 --- a/app/views/E2ESaveYourPasswordView.tsx +++ b/app/views/E2ESaveYourPasswordView.tsx @@ -15,9 +15,9 @@ import { E2E_RANDOM_PASSWORD_KEY, themes } from '../lib/constants'; import UserPreferences from '../lib/methods/userPreferences'; import { E2ESaveYourPasswordStackParamList } from '../stacks/types'; import { withTheme } from '../theme'; -import EventEmitter from '../utils/events'; -import { events, logEvent } from '../utils/log'; -import scrollPersistTaps from '../utils/scrollPersistTaps'; +import EventEmitter from '../lib/methods/helpers/events'; +import { events, logEvent } from '../lib/methods/helpers/log'; +import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; import sharedStyles from './Styles'; const styles = StyleSheet.create({ diff --git a/app/views/ForgotPasswordView.tsx b/app/views/ForgotPasswordView.tsx index 873ff23cc..6f69f340c 100644 --- a/app/views/ForgotPasswordView.tsx +++ b/app/views/ForgotPasswordView.tsx @@ -9,9 +9,8 @@ import { themes } from '../lib/constants'; import { Services } from '../lib/services'; import { OutsideParamList } from '../stacks/types'; import { withTheme } from '../theme'; -import { showErrorAlert } from '../utils/info'; -import isValidEmail from '../utils/isValidEmail'; -import { events, logEvent } from '../utils/log'; +import { showErrorAlert, isValidEmail } from '../lib/methods/helpers'; +import { events, logEvent } from '../lib/methods/helpers/log'; import { IBaseScreen } from '../definitions'; import sharedStyles from './Styles'; diff --git a/app/views/InviteUsersEditView/index.tsx b/app/views/InviteUsersEditView/index.tsx index 36fe41427..4ee14a9a3 100644 --- a/app/views/InviteUsersEditView/index.tsx +++ b/app/views/InviteUsersEditView/index.tsx @@ -14,7 +14,7 @@ import { IApplicationState, IBaseScreen } from '../../definitions'; import I18n from '../../i18n'; import { ChatsStackParamList } from '../../stacks/types'; import { withTheme } from '../../theme'; -import { events, logEvent } from '../../utils/log'; +import { events, logEvent } from '../../lib/methods/helpers/log'; import styles from './styles'; const OPTIONS = { diff --git a/app/views/InviteUsersView/index.tsx b/app/views/InviteUsersView/index.tsx index 9dedf2772..9bc3034b9 100644 --- a/app/views/InviteUsersView/index.tsx +++ b/app/views/InviteUsersView/index.tsx @@ -13,8 +13,8 @@ import { IApplicationState, IBaseScreen } from '../../definitions'; import I18n from '../../i18n'; import { ChatsStackParamList } from '../../stacks/types'; import { useTheme } from '../../theme'; -import { events, logEvent } from '../../utils/log'; -import scrollPersistTaps from '../../utils/scrollPersistTaps'; +import { events, logEvent } from '../../lib/methods/helpers/log'; +import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps'; import styles from './styles'; type IInviteUsersViewProps = IBaseScreen; diff --git a/app/views/JitsiMeetView.tsx b/app/views/JitsiMeetView.tsx index 59e716773..0a87f1bff 100644 --- a/app/views/JitsiMeetView.tsx +++ b/app/views/JitsiMeetView.tsx @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; import { getUserSelector } from '../selectors/login'; import ActivityIndicator from '../containers/ActivityIndicator'; -import { events, logEvent } from '../utils/log'; -import { isAndroid, isIOS } from '../utils/deviceInfo'; +import { events, logEvent } from '../lib/methods/helpers/log'; +import { isAndroid, isIOS } from '../lib/methods/helpers'; import { withTheme } from '../theme'; import { InsideStackParamList } from '../stacks/types'; import { IApplicationState, IUser, IBaseScreen } from '../definitions'; diff --git a/app/views/LanguageView/index.tsx b/app/views/LanguageView/index.tsx index d31e87ebb..04e3263d0 100644 --- a/app/views/LanguageView/index.tsx +++ b/app/views/LanguageView/index.tsx @@ -15,8 +15,8 @@ import database from '../../lib/database'; import { getUserSelector } from '../../selectors/login'; import { SettingsStackParamList } from '../../stacks/types'; import { withTheme } from '../../theme'; -import { showErrorAlert } from '../../utils/info'; -import log, { events, logEvent } from '../../utils/log'; +import { showErrorAlert } from '../../lib/methods/helpers/info'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; import { Services } from '../../lib/services'; interface ILanguageViewProps extends IBaseScreen { diff --git a/app/views/LegalView.tsx b/app/views/LegalView.tsx index c4ef9f66a..8d53fe4a4 100644 --- a/app/views/LegalView.tsx +++ b/app/views/LegalView.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import I18n from '../i18n'; import StatusBar from '../containers/StatusBar'; -import openLink from '../utils/openLink'; +import openLink from '../lib/methods/helpers/openLink'; import { useTheme } from '../theme'; import SafeAreaView from '../containers/SafeAreaView'; import * as List from '../containers/List'; diff --git a/app/views/LivechatEditView.tsx b/app/views/LivechatEditView.tsx index 40d9bf10c..cbc473a4c 100644 --- a/app/views/LivechatEditView.tsx +++ b/app/views/LivechatEditView.tsx @@ -11,8 +11,8 @@ import FormTextInput from '../containers/TextInput/FormTextInput'; import KeyboardView from '../containers/KeyboardView'; import I18n from '../i18n'; import { LISTENER } from '../containers/Toast'; -import EventEmitter from '../utils/events'; -import scrollPersistTaps from '../utils/scrollPersistTaps'; +import EventEmitter from '../lib/methods/helpers/events'; +import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; import { getUserSelector } from '../selectors/login'; import Button from '../containers/Button'; import SafeAreaView from '../containers/SafeAreaView'; @@ -21,7 +21,7 @@ import { ICustomFields, IInputsRefs, TParams, ITitle, ILivechat } from '../defin import { IApplicationState, IUser } from '../definitions'; import { ChatsStackParamList } from '../stacks/types'; import sharedStyles from './Styles'; -import { hasPermission } from '../lib/methods'; +import { hasPermission } from '../lib/methods/helpers'; import { Services } from '../lib/services'; const styles = StyleSheet.create({ diff --git a/app/views/MarkdownTableView.tsx b/app/views/MarkdownTableView.tsx index 65c56d729..f78509171 100644 --- a/app/views/MarkdownTableView.tsx +++ b/app/views/MarkdownTableView.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from 'react'; import { ScrollView } from 'react-native'; import I18n from '../i18n'; -import { isIOS } from '../utils/deviceInfo'; +import { isIOS } from '../lib/methods/helpers'; import { useTheme } from '../theme'; import { ChatsStackParamList } from '../stacks/types'; import { IBaseScreen } from '../definitions'; diff --git a/app/lib/methods/helpers/getFileUrlFromMessage.ts b/app/views/MessagesView/getFileUrlFromMessage.ts similarity index 100% rename from app/lib/methods/helpers/getFileUrlFromMessage.ts rename to app/views/MessagesView/getFileUrlFromMessage.ts diff --git a/app/views/MessagesView/index.tsx b/app/views/MessagesView/index.tsx index e5d6281de..6f3c5f2db 100644 --- a/app/views/MessagesView/index.tsx +++ b/app/views/MessagesView/index.tsx @@ -10,7 +10,7 @@ import Message from '../../containers/message'; import ActivityIndicator from '../../containers/ActivityIndicator'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; -import getFileUrlFromMessage from '../../lib/methods/helpers/getFileUrlFromMessage'; +import getFileUrlFromMessage from './getFileUrlFromMessage'; import { themes } from '../../lib/constants'; import { TSupportedThemes, withTheme } from '../../theme'; import { getUserSelector } from '../../selectors/login'; diff --git a/app/views/ModalBlockView.tsx b/app/views/ModalBlockView.tsx index bb7f02344..f1ef8341a 100644 --- a/app/views/ModalBlockView.tsx +++ b/app/views/ModalBlockView.tsx @@ -6,7 +6,7 @@ import { connect } from 'react-redux'; import { KeyboardAwareScrollView } from '@codler/react-native-keyboard-aware-scroll-view'; import { TSupportedThemes, withTheme } from '../theme'; -import EventEmitter from '../utils/events'; +import EventEmitter from '../lib/methods/helpers/events'; import { themes } from '../lib/constants'; import * as HeaderButton from '../containers/HeaderButton'; import { modalBlockWithContext } from '../containers/UIKit/MessageBlock'; diff --git a/app/views/NewMessageView.tsx b/app/views/NewMessageView.tsx index 0216044a0..a11871dfa 100644 --- a/app/views/NewMessageView.tsx +++ b/app/views/NewMessageView.tsx @@ -17,15 +17,15 @@ import I18n from '../i18n'; import database from '../lib/database'; import { CustomIcon, TIconsName } from '../containers/CustomIcon'; import Navigation from '../lib/navigation/appNavigation'; -import { compareServerVersion } from '../lib/methods/helpers/compareServerVersion'; import UserItem from '../containers/UserItem'; import { withTheme } from '../theme'; -import { goRoom, TGoRoomItem } from '../utils/goRoom'; -import log, { events, logEvent } from '../utils/log'; -import Touch from '../utils/touch'; +import { goRoom, TGoRoomItem } from '../lib/methods/helpers/goRoom'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; +import Touch from '../lib/methods/helpers/touch'; import sharedStyles from './Styles'; import { NewMessageStackParamList } from '../stacks/types'; -import { hasPermission, search } from '../lib/methods'; +import { search } from '../lib/methods'; +import { hasPermission, compareServerVersion } from '../lib/methods/helpers'; const QUERY_SIZE = 50; diff --git a/app/views/NewServerView/ServerInput/Item.tsx b/app/views/NewServerView/ServerInput/Item.tsx index e01ad941f..42b5a354c 100644 --- a/app/views/NewServerView/ServerInput/Item.tsx +++ b/app/views/NewServerView/ServerInput/Item.tsx @@ -5,7 +5,7 @@ import { BorderlessButton } from 'react-native-gesture-handler'; import { themes } from '../../../lib/constants'; import { CustomIcon } from '../../../containers/CustomIcon'; import sharedStyles from '../../Styles'; -import Touch from '../../../utils/touch'; +import Touch from '../../../lib/methods/helpers/touch'; import { TServerHistoryModel } from '../../../definitions/IServerHistory'; import { TSupportedThemes } from '../../../theme'; diff --git a/app/views/NewServerView/index.tsx b/app/views/NewServerView/index.tsx index a94bfd023..f4589039a 100644 --- a/app/views/NewServerView/index.tsx +++ b/app/views/NewServerView/index.tsx @@ -22,13 +22,13 @@ import { sanitizeLikeString } from '../../lib/database/utils'; import UserPreferences from '../../lib/methods/userPreferences'; import { OutsideParamList } from '../../stacks/types'; import { withTheme } from '../../theme'; -import { isTablet } from '../../utils/deviceInfo'; -import EventEmitter from '../../utils/events'; -import { BASIC_AUTH_KEY, setBasicAuth } from '../../utils/fetch'; -import { showConfirmationAlert } from '../../utils/info'; -import { events, logEvent } from '../../utils/log'; -import { moderateScale, verticalScale } from '../../utils/scaling'; -import SSLPinning from '../../utils/sslPinning'; +import { isTablet } from '../../lib/methods/helpers'; +import EventEmitter from '../../lib/methods/helpers/events'; +import { BASIC_AUTH_KEY, setBasicAuth } from '../../lib/methods/helpers/fetch'; +import { showConfirmationAlert } from '../../lib/methods/helpers/info'; +import { events, logEvent } from '../../lib/methods/helpers/log'; +import { moderateScale, verticalScale } from './scaling'; +import SSLPinning from '../../lib/methods/helpers/sslPinning'; import sharedStyles from '../Styles'; import ServerInput from './ServerInput'; diff --git a/app/utils/scaling.ts b/app/views/NewServerView/scaling.ts similarity index 91% rename from app/utils/scaling.ts rename to app/views/NewServerView/scaling.ts index 45d248d37..4d49bc1be 100644 --- a/app/utils/scaling.ts +++ b/app/views/NewServerView/scaling.ts @@ -1,4 +1,4 @@ -import { isTablet } from './deviceInfo'; +import { isTablet } from '../../lib/methods/helpers'; const guidelineBaseWidth = isTablet ? 600 : 375; const guidelineBaseHeight = isTablet ? 800 : 667; diff --git a/app/views/NotificationPreferencesView/index.tsx b/app/views/NotificationPreferencesView/index.tsx index 75a263b6b..d9e0d3142 100644 --- a/app/views/NotificationPreferencesView/index.tsx +++ b/app/views/NotificationPreferencesView/index.tsx @@ -12,7 +12,7 @@ import I18n from '../../i18n'; import { TSupportedThemes, withTheme } from '../../theme'; import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import SafeAreaView from '../../containers/SafeAreaView'; -import log, { events, logEvent } from '../../utils/log'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; import sharedStyles from '../Styles'; import { IOptionsField, OPTIONS } from './options'; import { ChatsStackParamList } from '../../stacks/types'; diff --git a/app/views/PickerView.tsx b/app/views/PickerView.tsx index edbe271ce..7608704dd 100644 --- a/app/views/PickerView.tsx +++ b/app/views/PickerView.tsx @@ -5,7 +5,7 @@ import { IBaseScreen } from '../definitions'; import I18n from '../i18n'; import { TSupportedThemes, withTheme } from '../theme'; import { themes } from '../lib/constants'; -import debounce from '../utils/debounce'; +import { debounce } from '../lib/methods/helpers'; import * as List from '../containers/List'; import SearchBox from '../containers/SearchBox'; import SafeAreaView from '../containers/SafeAreaView'; diff --git a/app/views/ProfileView/index.tsx b/app/views/ProfileView/index.tsx index aa3d7b5fe..d33c9dc5c 100644 --- a/app/views/ProfileView/index.tsx +++ b/app/views/ProfileView/index.tsx @@ -9,15 +9,15 @@ import { dequal } from 'dequal'; import omit from 'lodash/omit'; import { StackNavigationOptions } from '@react-navigation/stack'; -import Touch from '../../utils/touch'; +import Touch from '../../lib/methods/helpers/touch'; import KeyboardView from '../../containers/KeyboardView'; import sharedStyles from '../Styles'; -import scrollPersistTaps from '../../utils/scrollPersistTaps'; -import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; +import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps'; +import { showConfirmationAlert, showErrorAlert } from '../../lib/methods/helpers/info'; import { LISTENER } from '../../containers/Toast'; -import EventEmitter from '../../utils/events'; +import EventEmitter from '../../lib/methods/helpers/events'; import FormTextInput from '../../containers/TextInput/FormTextInput'; -import log, { events, logEvent } from '../../utils/log'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; import I18n from '../../i18n'; import Button from '../../containers/Button'; import Avatar from '../../containers/Avatar'; diff --git a/app/views/RegisterView.tsx b/app/views/RegisterView.tsx index d595efed4..ee38ab92a 100644 --- a/app/views/RegisterView.tsx +++ b/app/views/RegisterView.tsx @@ -15,10 +15,9 @@ import I18n from '../i18n'; import { getShowLoginButton } from '../selectors/login'; import { OutsideParamList } from '../stacks/types'; import { withTheme } from '../theme'; -import { showErrorAlert } from '../utils/info'; -import isValidEmail from '../utils/isValidEmail'; -import log, { events, logEvent } from '../utils/log'; -import openLink from '../utils/openLink'; +import { showErrorAlert, isValidEmail } from '../lib/methods/helpers'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; +import openLink from '../lib/methods/helpers/openLink'; import sharedStyles from './Styles'; import { Services } from '../lib/services'; diff --git a/app/views/RoomActionsView/index.tsx b/app/views/RoomActionsView/index.tsx index dc1fdac74..aea34b828 100644 --- a/app/views/RoomActionsView/index.tsx +++ b/app/views/RoomActionsView/index.tsx @@ -25,24 +25,23 @@ import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import { getUserSelector } from '../../selectors/login'; import { ChatsStackParamList } from '../../stacks/types'; import { withTheme } from '../../theme'; -import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; -import log, { events, logEvent } from '../../utils/log'; -import Touch from '../../utils/touch'; +import { showConfirmationAlert, showErrorAlert } from '../../lib/methods/helpers/info'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; +import Touch from '../../lib/methods/helpers/touch'; import sharedStyles from '../Styles'; import styles from './styles'; import { ERoomType } from '../../definitions/ERoomType'; import { E2E_ROOM_TYPES, SWITCH_TRACK_COLOR, themes } from '../../lib/constants'; -import { compareServerVersion } from '../../lib/methods/helpers/compareServerVersion'; +import { callJitsi, getPermalinkChannel } from '../../lib/methods'; import { - callJitsi, canAutoTranslate as canAutoTranslateMethod, - getPermalinkChannel, getRoomAvatar, getRoomTitle, getUidDirectMessage, hasPermission, - isGroupChat -} from '../../lib/methods'; + isGroupChat, + compareServerVersion +} from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; import { getSubscriptionByRoomId } from '../../lib/database/services/Subscription'; diff --git a/app/views/RoomInfoEditView/index.tsx b/app/views/RoomInfoEditView/index.tsx index 0fb61c071..6fd5f7cff 100644 --- a/app/views/RoomInfoEditView/index.tsx +++ b/app/views/RoomInfoEditView/index.tsx @@ -35,17 +35,21 @@ import { TSupportedPermissions } from '../../reducers/permissions'; import { ModalStackParamList } from '../../stacks/MasterDetailStack/types'; import { ChatsStackParamList } from '../../stacks/types'; import { withTheme } from '../../theme'; -import EventEmitter from '../../utils/events'; -import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; -import log, { events, logEvent } from '../../utils/log'; -import { MessageTypeValues } from '../../utils/messageTypes'; -import random from '../../utils/random'; -import scrollPersistTaps from '../../utils/scrollPersistTaps'; +import EventEmitter from '../../lib/methods/helpers/events'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; +import { MessageTypeValues } from './messageTypes'; +import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps'; import sharedStyles from '../Styles'; import styles from './styles'; import SwitchContainer from './SwitchContainer'; -import { compareServerVersion } from '../../lib/methods/helpers/compareServerVersion'; -import { getRoomTitle, hasPermission } from '../../lib/methods'; +import { + getRoomTitle, + hasPermission, + compareServerVersion, + showConfirmationAlert, + showErrorAlert, + random +} from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; interface IRoomInfoEditViewState { diff --git a/app/utils/messageTypes.ts b/app/views/RoomInfoEditView/messageTypes.ts similarity index 100% rename from app/utils/messageTypes.ts rename to app/views/RoomInfoEditView/messageTypes.ts diff --git a/app/views/RoomInfoView/index.tsx b/app/views/RoomInfoView/index.tsx index 65798811c..9028aa79e 100644 --- a/app/views/RoomInfoView/index.tsx +++ b/app/views/RoomInfoView/index.tsx @@ -16,14 +16,14 @@ import RoomTypeIcon from '../../containers/RoomTypeIcon'; import I18n from '../../i18n'; import * as HeaderButton from '../../containers/HeaderButton'; import StatusBar from '../../containers/StatusBar'; -import log, { events, logEvent } from '../../utils/log'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; import { themes } from '../../lib/constants'; import { TSupportedThemes, withTheme } from '../../theme'; import { MarkdownPreview } from '../../containers/markdown'; import { LISTENER } from '../../containers/Toast'; -import EventEmitter from '../../utils/events'; +import EventEmitter from '../../lib/methods/helpers/events'; import SafeAreaView from '../../containers/SafeAreaView'; -import { goRoom } from '../../utils/goRoom'; +import { goRoom } from '../../lib/methods/helpers/goRoom'; import Navigation from '../../lib/navigation/appNavigation'; import Livechat from './Livechat'; import Channel from './Channel'; @@ -33,7 +33,8 @@ import { ChatsStackParamList } from '../../stacks/types'; import { MasterDetailInsideStackParamList } from '../../stacks/MasterDetailStack/types'; import { SubscriptionType, TSubscriptionModel, ISubscription, IUser, IApplicationState } from '../../definitions'; import { ILivechatVisitor } from '../../definitions/ILivechatVisitor'; -import { callJitsi, getRoomTitle, getUidDirectMessage, hasPermission } from '../../lib/methods'; +import { callJitsi } from '../../lib/methods'; +import { getRoomTitle, getUidDirectMessage, hasPermission } from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; interface IGetRoomTitle { diff --git a/app/views/RoomMembersView/index.tsx b/app/views/RoomMembersView/index.tsx index ff831c5c1..faaef21fd 100644 --- a/app/views/RoomMembersView/index.tsx +++ b/app/views/RoomMembersView/index.tsx @@ -22,13 +22,14 @@ import UserItem from '../../containers/UserItem'; import { getUserSelector } from '../../selectors/login'; import { ModalStackParamList } from '../../stacks/MasterDetailStack/types'; import { TSupportedThemes, withTheme } from '../../theme'; -import EventEmitter from '../../utils/events'; -import { goRoom, TGoRoomItem } from '../../utils/goRoom'; -import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; -import log from '../../utils/log'; -import scrollPersistTaps from '../../utils/scrollPersistTaps'; +import EventEmitter from '../../lib/methods/helpers/events'; +import { goRoom, TGoRoomItem } from '../../lib/methods/helpers/goRoom'; +import { showConfirmationAlert, showErrorAlert } from '../../lib/methods/helpers/info'; +import log from '../../lib/methods/helpers/log'; +import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps'; import { TSupportedPermissions } from '../../reducers/permissions'; -import { getRoomTitle, hasPermission, isGroupChat, RoomTypes } from '../../lib/methods'; +import { RoomTypes } from '../../lib/methods'; +import { getRoomTitle, hasPermission, isGroupChat } from '../../lib/methods/helpers'; import styles from './styles'; import { Services } from '../../lib/services'; diff --git a/app/views/RoomView/List/List.tsx b/app/views/RoomView/List/List.tsx index 438e25743..3ef7c0455 100644 --- a/app/views/RoomView/List/List.tsx +++ b/app/views/RoomView/List/List.tsx @@ -3,8 +3,8 @@ import { FlatList, FlatListProps, StyleSheet } from 'react-native'; import Animated from 'react-native-reanimated'; import PropTypes from 'prop-types'; -import { isIOS } from '../../../utils/deviceInfo'; -import scrollPersistTaps from '../../../utils/scrollPersistTaps'; +import { isIOS } from '../../../lib/methods/helpers'; +import scrollPersistTaps from '../../../lib/methods/helpers/scrollPersistTaps'; const AnimatedFlatList = Animated.createAnimatedComponent(FlatList); diff --git a/app/views/RoomView/List/NavBottomFAB.tsx b/app/views/RoomView/List/NavBottomFAB.tsx index 9b885904b..895c1278a 100644 --- a/app/views/RoomView/List/NavBottomFAB.tsx +++ b/app/views/RoomView/List/NavBottomFAB.tsx @@ -5,8 +5,8 @@ import Animated, { call, cond, greaterOrEq, useCode } from 'react-native-reanima import { themes } from '../../../lib/constants'; import { CustomIcon } from '../../../containers/CustomIcon'; import { useTheme } from '../../../theme'; -import Touch from '../../../utils/touch'; -import { hasNotch } from '../../../utils/deviceInfo'; +import Touch from '../../../lib/methods/helpers/touch'; +import { hasNotch } from '../../../lib/methods/helpers'; const SCROLL_LIMIT = 200; const SEND_TO_CHANNEL_HEIGHT = 40; diff --git a/app/views/RoomView/List/index.tsx b/app/views/RoomView/List/index.tsx index 226b976a0..ec015340f 100644 --- a/app/views/RoomView/List/index.tsx +++ b/app/views/RoomView/List/index.tsx @@ -11,10 +11,9 @@ import { themes } from '../../../lib/constants'; import ActivityIndicator from '../../../containers/ActivityIndicator'; import { TAnyMessageModel, TMessageModel, TThreadMessageModel, TThreadModel } from '../../../definitions'; import database from '../../../lib/database'; -import { compareServerVersion } from '../../../lib/methods/helpers/compareServerVersion'; -import debounce from '../../../utils/debounce'; -import { animateNextTransition } from '../../../utils/layoutAnimation'; -import log from '../../../utils/log'; +import { compareServerVersion, debounce } from '../../../lib/methods/helpers'; +import { animateNextTransition } from '../../../lib/methods/helpers/layoutAnimation'; +import log from '../../../lib/methods/helpers/log'; import EmptyRoom from '../EmptyRoom'; import List, { IListProps, TListRef } from './List'; import NavBottomFAB from './NavBottomFAB'; diff --git a/app/views/RoomView/LoadMore/index.tsx b/app/views/RoomView/LoadMore/index.tsx index fcd353924..bb88c525c 100644 --- a/app/views/RoomView/LoadMore/index.tsx +++ b/app/views/RoomView/LoadMore/index.tsx @@ -4,7 +4,7 @@ import { ActivityIndicator, StyleSheet, Text } from 'react-native'; import { MessageTypeLoad, themes } from '../../../lib/constants'; import { MessageType } from '../../../definitions'; import { useTheme } from '../../../theme'; -import Touch from '../../../utils/touch'; +import Touch from '../../../lib/methods/helpers/touch'; import sharedStyles from '../../Styles'; import I18n from '../../../i18n'; diff --git a/app/views/RoomView/ReactionPicker.tsx b/app/views/RoomView/ReactionPicker.tsx index f4ed4378d..06dd50d8f 100644 --- a/app/views/RoomView/ReactionPicker.tsx +++ b/app/views/RoomView/ReactionPicker.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import Modal from 'react-native-modal'; import EmojiPicker from '../../containers/EmojiPicker'; -import { isAndroid } from '../../utils/deviceInfo'; +import { isAndroid } from '../../lib/methods/helpers'; import { themes } from '../../lib/constants'; import { TSupportedThemes, withTheme } from '../../theme'; import styles from './styles'; diff --git a/app/views/RoomView/RightButtons.tsx b/app/views/RoomView/RightButtons.tsx index 4e5bd51dc..ca952532c 100644 --- a/app/views/RoomView/RightButtons.tsx +++ b/app/views/RoomView/RightButtons.tsx @@ -7,8 +7,8 @@ import { StackNavigationProp } from '@react-navigation/stack'; import * as HeaderButton from '../../containers/HeaderButton'; import database from '../../lib/database'; import { getUserSelector } from '../../selectors/login'; -import { events, logEvent } from '../../utils/log'; -import { isTeamRoom } from '../../utils/room'; +import { events, logEvent } from '../../lib/methods/helpers/log'; +import { isTeamRoom } from '../../lib/methods/helpers/room'; import { IApplicationState, SubscriptionType, TMessageModel, TSubscriptionModel } from '../../definitions'; import { ChatsStackParamList } from '../../stacks/types'; diff --git a/app/views/RoomView/UploadProgress.tsx b/app/views/RoomView/UploadProgress.tsx index 2c4cef225..d8abd5282 100644 --- a/app/views/RoomView/UploadProgress.tsx +++ b/app/views/RoomView/UploadProgress.tsx @@ -4,7 +4,7 @@ import { Q } from '@nozbe/watermelondb'; import { Observable, Subscription } from 'rxjs'; import database from '../../lib/database'; -import log from '../../utils/log'; +import log from '../../lib/methods/helpers/log'; import I18n from '../../i18n'; import { CustomIcon } from '../../containers/CustomIcon'; import { themes } from '../../lib/constants'; diff --git a/app/views/RoomView/index.tsx b/app/views/RoomView/index.tsx index b1bf3298f..5bf99bba4 100644 --- a/app/views/RoomView/index.tsx +++ b/app/views/RoomView/index.tsx @@ -9,25 +9,23 @@ import { dequal } from 'dequal'; import { EdgeInsets, withSafeAreaInsets } from 'react-native-safe-area-context'; import { Subscription } from 'rxjs'; -import Touch from '../../utils/touch'; +import Touch from '../../lib/methods/helpers/touch'; import { replyBroadcast } from '../../actions/messages'; import database from '../../lib/database'; import Message from '../../containers/message'; import MessageActions, { IMessageActions } from '../../containers/MessageActions'; import MessageErrorActions, { IMessageErrorActions } from '../../containers/MessageErrorActions'; import MessageBox, { MessageBoxType } from '../../containers/MessageBox'; -import log, { events, logEvent } from '../../utils/log'; -import EventEmitter from '../../utils/events'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; +import EventEmitter from '../../lib/methods/helpers/events'; import I18n from '../../i18n'; import RoomHeader from '../../containers/RoomHeader'; import StatusBar from '../../containers/StatusBar'; -import debounce from '../../utils/debounce'; import ReactionsModal from '../../containers/ReactionsModal'; import { LISTENER } from '../../containers/Toast'; -import { getBadgeColor, isBlocked, isTeamRoom, makeThreadName } from '../../utils/room'; -import { isReadOnly } from '../../utils/isReadOnly'; -import { isIOS, isTablet } from '../../utils/deviceInfo'; -import { showErrorAlert } from '../../utils/info'; +import { getBadgeColor, isBlocked, isTeamRoom, makeThreadName } from '../../lib/methods/helpers/room'; +import { isReadOnly } from '../../lib/methods/helpers/isReadOnly'; +import { showErrorAlert } from '../../lib/methods/helpers/info'; import { withTheme } from '../../theme'; import { KEY_COMMAND, @@ -37,7 +35,7 @@ import { handleCommandSearchMessages, IKeyCommandEvent } from '../../commands'; -import { Review } from '../../utils/review'; +import { Review } from '../../lib/methods/helpers/review'; import RoomClass from '../../lib/methods/subscriptions/room'; import { getUserSelector } from '../../selectors/login'; import Navigation from '../../lib/navigation/appNavigation'; @@ -45,7 +43,7 @@ import SafeAreaView from '../../containers/SafeAreaView'; import { withDimensions } from '../../dimensions'; import { takeInquiry, takeResume } from '../../ee/omnichannel/lib'; import Loading from '../../containers/Loading'; -import { goRoom, TGoRoomItem } from '../../utils/goRoom'; +import { goRoom, TGoRoomItem } from '../../lib/methods/helpers/goRoom'; import getThreadName from '../../lib/methods/getThreadName'; import getRoomInfo from '../../lib/methods/getRoomInfo'; import { ContainerTypes } from '../../containers/UIKit/interfaces'; @@ -83,16 +81,21 @@ import { TListRef } from './List/List'; import { ModalStackParamList } from '../../stacks/MasterDetailStack/types'; import { callJitsi, - canAutoTranslate as canAutoTranslateMethod, - getRoomTitle, - getUidDirectMessage, - isGroupChat, loadSurroundingMessages, loadThreadMessages, readMessages, sendMessage, triggerBlockAction } from '../../lib/methods'; +import { + isGroupChat, + getUidDirectMessage, + getRoomTitle, + canAutoTranslate as canAutoTranslateMethod, + debounce, + isIOS, + isTablet +} from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; type TStateAttrsUpdate = keyof IRoomViewState; diff --git a/app/views/RoomsListView/Header/Header.tsx b/app/views/RoomsListView/Header/Header.tsx index 8965f797d..e7aeb7c2e 100644 --- a/app/views/RoomsListView/Header/Header.tsx +++ b/app/views/RoomsListView/Header/Header.tsx @@ -6,7 +6,7 @@ import I18n from '../../../i18n'; import sharedStyles from '../../Styles'; import { themes } from '../../../lib/constants'; import { CustomIcon } from '../../../containers/CustomIcon'; -import { isIOS, isTablet } from '../../../utils/deviceInfo'; +import { isIOS, isTablet } from '../../../lib/methods/helpers'; import { useOrientation } from '../../../dimensions'; import { useTheme } from '../../../theme'; diff --git a/app/views/RoomsListView/Header/index.tsx b/app/views/RoomsListView/Header/index.tsx index 55f49fc58..216705e8c 100644 --- a/app/views/RoomsListView/Header/index.tsx +++ b/app/views/RoomsListView/Header/index.tsx @@ -4,10 +4,10 @@ import { Dispatch } from 'redux'; import { toggleServerDropdown, closeServerDropdown, setSearch } from '../../../actions/rooms'; import { TSupportedThemes, withTheme } from '../../../theme'; -import EventEmitter from '../../../utils/events'; +import EventEmitter from '../../../lib/methods/helpers/events'; import { KEY_COMMAND, handleCommandOpenServerDropdown, IKeyCommandEvent } from '../../../commands'; -import { isTablet } from '../../../utils/deviceInfo'; -import { events, logEvent } from '../../../utils/log'; +import { isTablet } from '../../../lib/methods/helpers'; +import { events, logEvent } from '../../../lib/methods/helpers/log'; import Header from './Header'; import { IApplicationState } from '../../../definitions'; diff --git a/app/views/RoomsListView/ServerDropdown.tsx b/app/views/RoomsListView/ServerDropdown.tsx index 960240602..1ce5467e7 100644 --- a/app/views/RoomsListView/ServerDropdown.tsx +++ b/app/views/RoomsListView/ServerDropdown.tsx @@ -10,18 +10,18 @@ import { toggleServerDropdown } from '../../actions/rooms'; import { selectServerRequest, serverInitAdd } from '../../actions/server'; import { appStart } from '../../actions/app'; import I18n from '../../i18n'; -import EventEmitter from '../../utils/events'; +import EventEmitter from '../../lib/methods/helpers/events'; import ServerItem from '../../containers/ServerItem'; import database from '../../lib/database'; import { themes, TOKEN_KEY } from '../../lib/constants'; import { withTheme } from '../../theme'; import { KEY_COMMAND, handleCommandSelectServer, IKeyCommandEvent } from '../../commands'; -import { isTablet } from '../../utils/deviceInfo'; -import { localAuthenticate } from '../../utils/localAuthentication'; -import { showConfirmationAlert } from '../../utils/info'; -import log, { events, logEvent } from '../../utils/log'; +import { isTablet } from '../../lib/methods/helpers'; +import { localAuthenticate } from '../../lib/methods/helpers/localAuthentication'; +import { showConfirmationAlert } from '../../lib/methods/helpers/info'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; import { headerHeight } from '../../containers/Header'; -import { goRoom } from '../../utils/goRoom'; +import { goRoom } from '../../lib/methods/helpers/goRoom'; import UserPreferences from '../../lib/methods/userPreferences'; import { IApplicationState, IBaseScreen, RootEnum, TServerModel } from '../../definitions'; import styles from './styles'; diff --git a/app/views/RoomsListView/index.tsx b/app/views/RoomsListView/index.tsx index a9199bad2..cdb98a097 100644 --- a/app/views/RoomsListView/index.tsx +++ b/app/views/RoomsListView/index.tsx @@ -10,19 +10,17 @@ import { StackNavigationOptions } from '@react-navigation/stack'; import database from '../../lib/database'; import RoomItem, { ROW_HEIGHT, ROW_HEIGHT_CONDENSED } from '../../containers/RoomItem'; -import log, { logEvent, events } from '../../utils/log'; +import log, { logEvent, events } from '../../lib/methods/helpers/log'; import I18n from '../../i18n'; import { closeSearchHeader, closeServerDropdown, openSearchHeader, roomsRequest } from '../../actions/rooms'; import { appStart } from '../../actions/app'; -import debounce from '../../utils/debounce'; -import { isIOS, isTablet } from '../../utils/deviceInfo'; import * as HeaderButton from '../../containers/HeaderButton'; import StatusBar from '../../containers/StatusBar'; import ActivityIndicator from '../../containers/ActivityIndicator'; import { serverInitAdd } from '../../actions/server'; -import { animateNextTransition } from '../../utils/layoutAnimation'; +import { animateNextTransition } from '../../lib/methods/helpers/layoutAnimation'; import { withTheme } from '../../theme'; -import EventEmitter from '../../utils/events'; +import EventEmitter from '../../lib/methods/helpers/events'; import { KEY_COMMAND, handleCommandAddNewServer, @@ -35,7 +33,7 @@ import { IKeyCommandEvent } from '../../commands'; import { getUserSelector } from '../../selectors/login'; -import { goRoom } from '../../utils/goRoom'; +import { goRoom } from '../../lib/methods/helpers/goRoom'; import SafeAreaView from '../../containers/SafeAreaView'; import Header, { getHeaderTitlePosition } from '../../containers/Header'; import { withDimensions } from '../../dimensions'; @@ -46,17 +44,18 @@ import ServerDropdown from './ServerDropdown'; import ListHeader, { TEncryptionBanner } from './ListHeader'; import RoomsListHeaderView from './Header'; import { ChatsStackParamList } from '../../stacks/types'; +import { getUserPresence, RoomTypes, search } from '../../lib/methods'; import { getRoomAvatar, getRoomTitle, getUidDirectMessage, - getUserPresence, hasPermission, isGroupChat, isRead, - RoomTypes, - search -} from '../../lib/methods'; + debounce, + isIOS, + isTablet +} from '../../lib/methods/helpers'; import { E2E_BANNER_TYPE, DisplayMode, SortBy, MAX_SIDEBAR_WIDTH, themes } from '../../lib/constants'; import { Services } from '../../lib/services'; diff --git a/app/views/ScreenLockConfigView.tsx b/app/views/ScreenLockConfigView.tsx index 2bc7e9035..a90bb4210 100644 --- a/app/views/ScreenLockConfigView.tsx +++ b/app/views/ScreenLockConfigView.tsx @@ -9,10 +9,10 @@ import { TSupportedThemes, withTheme } from '../theme'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; import database from '../lib/database'; -import { changePasscode, checkHasPasscode, supportedBiometryLabel } from '../utils/localAuthentication'; +import { changePasscode, checkHasPasscode, supportedBiometryLabel } from '../lib/methods/helpers/localAuthentication'; import { BIOMETRY_ENABLED_KEY, DEFAULT_AUTO_LOCK, themes, SWITCH_TRACK_COLOR } from '../lib/constants'; import SafeAreaView from '../containers/SafeAreaView'; -import { events, logEvent } from '../utils/log'; +import { events, logEvent } from '../lib/methods/helpers/log'; import userPreferences from '../lib/methods/userPreferences'; import { IApplicationState, TServerModel } from '../definitions'; diff --git a/app/views/ScreenLockedView.tsx b/app/views/ScreenLockedView.tsx index 7cf21abed..0c2c83fad 100644 --- a/app/views/ScreenLockedView.tsx +++ b/app/views/ScreenLockedView.tsx @@ -10,8 +10,8 @@ import { PasscodeEnter } from '../containers/Passcode'; import { LOCAL_AUTHENTICATE_EMITTER } from '../lib/constants'; import { CustomIcon } from '../containers/CustomIcon'; import { useTheme } from '../theme'; -import { hasNotch, isTablet } from '../utils/deviceInfo'; -import EventEmitter from '../utils/events'; +import { hasNotch, isTablet } from '../lib/methods/helpers'; +import EventEmitter from '../lib/methods/helpers/events'; interface IData { submit?: () => void; diff --git a/app/views/SearchMessagesView/index.tsx b/app/views/SearchMessagesView/index.tsx index 93f259a15..033dc1518 100644 --- a/app/views/SearchMessagesView/index.tsx +++ b/app/views/SearchMessagesView/index.tsx @@ -6,17 +6,14 @@ import { Q } from '@nozbe/watermelondb'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; -import { ISubscription, SubscriptionType, TSubscriptionModel } from '../../definitions/ISubscription'; -import { IAttachment } from '../../definitions/IAttachment'; import FormTextInput from '../../containers/TextInput/FormTextInput'; import ActivityIndicator from '../../containers/ActivityIndicator'; import Markdown from '../../containers/markdown'; -import debounce from '../../utils/debounce'; import Message from '../../containers/message'; -import scrollPersistTaps from '../../utils/scrollPersistTaps'; +import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; -import log from '../../utils/log'; +import log from '../../lib/methods/helpers/log'; import { themes } from '../../lib/constants'; import { TSupportedThemes, withTheme } from '../../theme'; import { getUserSelector } from '../../selectors/login'; @@ -26,12 +23,20 @@ import database from '../../lib/database'; import { sanitizeLikeString } from '../../lib/database/utils'; import getThreadName from '../../lib/methods/getThreadName'; import getRoomInfo, { IRoomInfoResult } from '../../lib/methods/getRoomInfo'; -import { isIOS } from '../../utils/deviceInfo'; import styles from './styles'; import { InsideStackParamList, ChatsStackParamList } from '../../stacks/types'; -import { IEmoji } from '../../definitions/IEmoji'; -import { compareServerVersion } from '../../lib/methods/helpers/compareServerVersion'; -import { IMessageFromServer, IUser, TMessageModel, IUrl } from '../../definitions'; +import { compareServerVersion, debounce, isIOS } from '../../lib/methods/helpers'; +import { + IMessageFromServer, + IUser, + TMessageModel, + IUrl, + IEmoji, + IAttachment, + ISubscription, + SubscriptionType, + TSubscriptionModel +} from '../../definitions'; import { Services } from '../../lib/services'; const QUERY_SIZE = 50; diff --git a/app/views/SecurityPrivacyView.tsx b/app/views/SecurityPrivacyView.tsx index b57b7ae7a..db4e02020 100644 --- a/app/views/SecurityPrivacyView.tsx +++ b/app/views/SecurityPrivacyView.tsx @@ -11,7 +11,7 @@ import { ANALYTICS_EVENTS_KEY, CRASH_REPORT_KEY, isFDroidBuild, SWITCH_TRACK_COL import { useAppSelector } from '../lib/hooks'; import useServer from '../lib/methods/useServer'; import { SettingsStackParamList } from '../stacks/types'; -import { handleLocalAuthentication } from '../utils/localAuthentication'; +import { handleLocalAuthentication } from '../lib/methods/helpers/localAuthentication'; import { events, getReportAnalyticsEventsValue, @@ -19,7 +19,7 @@ import { logEvent, toggleAnalyticsEventsReport, toggleCrashErrorsReport -} from '../utils/log'; +} from '../lib/methods/helpers/log'; interface ISecurityPrivacyViewProps { navigation: StackNavigationProp; diff --git a/app/views/SelectListView.tsx b/app/views/SelectListView.tsx index 98a03a620..fedaeb9c4 100644 --- a/app/views/SelectListView.tsx +++ b/app/views/SelectListView.tsx @@ -6,7 +6,7 @@ import { RadioButton } from 'react-native-ui-lib'; import { RouteProp } from '@react-navigation/native'; import { ChatsStackParamList } from '../stacks/types'; -import log from '../utils/log'; +import log from '../lib/methods/helpers/log'; import * as List from '../containers/List'; import I18n from '../i18n'; import * as HeaderButton from '../containers/HeaderButton'; @@ -14,7 +14,7 @@ import StatusBar from '../containers/StatusBar'; import { themes } from '../lib/constants'; import { TSupportedThemes, withTheme } from '../theme'; import SafeAreaView from '../containers/SafeAreaView'; -import { animateNextTransition } from '../utils/layoutAnimation'; +import { animateNextTransition } from '../lib/methods/helpers/layoutAnimation'; import { ICON_SIZE } from '../containers/List/constants'; import SearchBox from '../containers/SearchBox'; import sharedStyles from './Styles'; diff --git a/app/views/SelectedUsersView.tsx b/app/views/SelectedUsersView.tsx index 47eafaa86..6c434a930 100644 --- a/app/views/SelectedUsersView.tsx +++ b/app/views/SelectedUsersView.tsx @@ -21,10 +21,11 @@ import { ISelectedUser } from '../reducers/selectedUsers'; import { getUserSelector } from '../selectors/login'; import { ChatsStackParamList } from '../stacks/types'; import { withTheme } from '../theme'; -import { showErrorAlert } from '../utils/info'; -import log, { events, logEvent } from '../utils/log'; +import { showErrorAlert } from '../lib/methods/helpers/info'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; import sharedStyles from './Styles'; -import { isGroupChat, search } from '../lib/methods'; +import { search } from '../lib/methods'; +import { isGroupChat } from '../lib/methods/helpers'; const ITEM_WIDTH = 250; const getItemLayout = (_: any, index: number) => ({ length: ITEM_WIDTH, offset: ITEM_WIDTH * index, index }); diff --git a/app/views/SendEmailConfirmationView.tsx b/app/views/SendEmailConfirmationView.tsx index cdcbed9f2..11b4bcafc 100644 --- a/app/views/SendEmailConfirmationView.tsx +++ b/app/views/SendEmailConfirmationView.tsx @@ -3,12 +3,11 @@ import React, { useEffect, useState } from 'react'; import { OutsideParamList } from '../stacks/types'; import FormTextInput from '../containers/TextInput/FormTextInput'; import Button from '../containers/Button'; -import { showErrorAlert } from '../utils/info'; -import isValidEmail from '../utils/isValidEmail'; +import { showErrorAlert, isValidEmail } from '../lib/methods/helpers'; import I18n from '../i18n'; import { useTheme } from '../theme'; import FormContainer, { FormContainerInner } from '../containers/FormContainer'; -import log, { events, logEvent } from '../utils/log'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; import sharedStyles from './Styles'; import { IBaseScreen } from '../definitions'; import { Services } from '../lib/services'; diff --git a/app/views/SetUsernameView.tsx b/app/views/SetUsernameView.tsx index 14c878d8c..80f005049 100644 --- a/app/views/SetUsernameView.tsx +++ b/app/views/SetUsernameView.tsx @@ -18,9 +18,9 @@ import I18n from '../i18n'; import KeyboardView from '../containers/KeyboardView'; import { getUserSelector } from '../selectors/login'; import { TSupportedThemes, withTheme } from '../theme'; -import { isTablet } from '../utils/deviceInfo'; -import { showErrorAlert } from '../utils/info'; -import scrollPersistTaps from '../utils/scrollPersistTaps'; +import { isTablet } from '../lib/methods/helpers'; +import { showErrorAlert } from '../lib/methods/helpers/info'; +import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; import sharedStyles from './Styles'; import { Services } from '../lib/services'; diff --git a/app/views/SettingsView/index.tsx b/app/views/SettingsView/index.tsx index 5549a3fec..caf7e1884 100644 --- a/app/views/SettingsView/index.tsx +++ b/app/views/SettingsView/index.tsx @@ -22,12 +22,12 @@ import { IServer } from '../../reducers/server'; import { getUserSelector } from '../../selectors/login'; import { SettingsStackParamList } from '../../stacks/types'; import { withTheme } from '../../theme'; -import { getDeviceModel, getReadableVersion, isAndroid } from '../../utils/deviceInfo'; -import EventEmitter from '../../utils/events'; -import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; -import { events, logEvent } from '../../utils/log'; -import openLink from '../../utils/openLink'; -import { onReviewPress } from '../../utils/review'; +import { getDeviceModel, getReadableVersion, isAndroid } from '../../lib/methods/helpers'; +import EventEmitter from '../../lib/methods/helpers/events'; +import { showConfirmationAlert, showErrorAlert } from '../../lib/methods/helpers/info'; +import { events, logEvent } from '../../lib/methods/helpers/log'; +import openLink from '../../lib/methods/helpers/openLink'; +import { onReviewPress } from '../../lib/methods/helpers/review'; import SidebarView from '../SidebarView'; import { clearCache } from '../../lib/methods'; import { Services } from '../../lib/services'; diff --git a/app/views/ShareListView/Header/Header.ios.tsx b/app/views/ShareListView/Header/Header.ios.tsx index 136d49b00..59058fbda 100644 --- a/app/views/ShareListView/Header/Header.ios.tsx +++ b/app/views/ShareListView/Header/Header.ios.tsx @@ -6,7 +6,7 @@ import SearchBox from './SearchBox'; import * as HeaderButton from '../../../containers/HeaderButton'; import { themes } from '../../../lib/constants'; import sharedStyles from '../../Styles'; -import { animateNextTransition } from '../../../utils/layoutAnimation'; +import { animateNextTransition } from '../../../lib/methods/helpers/layoutAnimation'; import { IShareListHeaderIos } from './interface'; const styles = StyleSheet.create({ diff --git a/app/views/ShareListView/Header/SearchBox.tsx b/app/views/ShareListView/Header/SearchBox.tsx index a88516d87..4ab12ee20 100644 --- a/app/views/ShareListView/Header/SearchBox.tsx +++ b/app/views/ShareListView/Header/SearchBox.tsx @@ -7,7 +7,7 @@ import I18n from '../../../i18n'; import { CustomIcon } from '../../../containers/CustomIcon'; import TextInput from '../../../containers/TextInput'; import { useTheme } from '../../../theme'; -import { isIOS } from '../../../utils/deviceInfo'; +import { isIOS } from '../../../lib/methods/helpers'; import sharedStyles from '../../Styles'; const styles = StyleSheet.create({ diff --git a/app/views/ShareListView/index.tsx b/app/views/ShareListView/index.tsx index 0811117e6..7ce7e5259 100644 --- a/app/views/ShareListView/index.tsx +++ b/app/views/ShareListView/index.tsx @@ -9,7 +9,6 @@ import { dequal } from 'dequal'; import { Q } from '@nozbe/watermelondb'; import database from '../../lib/database'; -import { isAndroid, isIOS } from '../../utils/deviceInfo'; import I18n from '../../i18n'; import DirectoryItem, { ROW_HEIGHT } from '../../containers/DirectoryItem'; import ServerItem from '../../containers/ServerItem'; @@ -17,7 +16,7 @@ import * as HeaderButton from '../../containers/HeaderButton'; import ActivityIndicator from '../../containers/ActivityIndicator'; import * as List from '../../containers/List'; import { themes } from '../../lib/constants'; -import { animateNextTransition } from '../../utils/layoutAnimation'; +import { animateNextTransition } from '../../lib/methods/helpers/layoutAnimation'; import { TSupportedThemes, withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; import { sanitizeLikeString } from '../../lib/database/utils'; @@ -25,7 +24,7 @@ import styles from './styles'; import ShareListHeader from './Header'; import { TServerModel, TSubscriptionModel } from '../../definitions'; import { ShareInsideStackParamList } from '../../definitions/navigationTypes'; -import { getRoomAvatar } from '../../lib/methods'; +import { getRoomAvatar, isAndroid, isIOS } from '../../lib/methods/helpers'; interface IDataFromShare { value: string; diff --git a/app/views/ShareListView/styles.ts b/app/views/ShareListView/styles.ts index 2c08ee9f9..5a3241da9 100644 --- a/app/views/ShareListView/styles.ts +++ b/app/views/ShareListView/styles.ts @@ -1,6 +1,6 @@ import { StyleSheet } from 'react-native'; -import { isIOS } from '../../utils/deviceInfo'; +import { isIOS } from '../../lib/methods/helpers'; import sharedStyles from '../Styles'; export default StyleSheet.create({ diff --git a/app/views/ShareView/Header.tsx b/app/views/ShareView/Header.tsx index d2eb6351c..3032bbbe4 100644 --- a/app/views/ShareView/Header.tsx +++ b/app/views/ShareView/Header.tsx @@ -5,11 +5,10 @@ import I18n from '../../i18n'; import { CustomIcon, TIconsName } from '../../containers/CustomIcon'; import { themes } from '../../lib/constants'; import { useTheme } from '../../theme'; -import { isAndroid, isTablet } from '../../utils/deviceInfo'; import sharedStyles from '../Styles'; -import { makeThreadName } from '../../utils/room'; +import { makeThreadName } from '../../lib/methods/helpers/room'; import { ISubscription, TThreadModel } from '../../definitions'; -import { getRoomTitle, isGroupChat } from '../../lib/methods'; +import { getRoomTitle, isGroupChat, isAndroid, isTablet } from '../../lib/methods/helpers'; const androidMarginLeft = isTablet ? 0 : 4; diff --git a/app/views/ShareView/Preview.tsx b/app/views/ShareView/Preview.tsx index 23c371d02..50dc74029 100644 --- a/app/views/ShareView/Preview.tsx +++ b/app/views/ShareView/Preview.tsx @@ -10,7 +10,7 @@ import { useDimensions, useOrientation } from '../../dimensions'; import { getHeaderHeight } from '../../containers/Header'; import sharedStyles from '../Styles'; import I18n from '../../i18n'; -import { isAndroid } from '../../utils/deviceInfo'; +import { isAndroid } from '../../lib/methods/helpers'; import { allowPreview } from './utils'; import { THUMBS_HEIGHT } from './constants'; import { TSupportedThemes } from '../../theme'; diff --git a/app/views/ShareView/Thumbs.tsx b/app/views/ShareView/Thumbs.tsx index d6ee5ae6f..ca8e2f6c1 100644 --- a/app/views/ShareView/Thumbs.tsx +++ b/app/views/ShareView/Thumbs.tsx @@ -5,7 +5,7 @@ import { RectButton, TouchableNativeFeedback, TouchableOpacity } from 'react-nat import { BUTTON_HIT_SLOP } from '../../containers/message/utils'; import { themes } from '../../lib/constants'; import { CustomIcon } from '../../containers/CustomIcon'; -import { isIOS } from '../../utils/deviceInfo'; +import { isIOS } from '../../lib/methods/helpers'; import { THUMBS_HEIGHT } from './constants'; import { allowPreview } from './utils'; import { TSupportedThemes } from '../../theme'; diff --git a/app/views/ShareView/index.tsx b/app/views/ShareView/index.tsx index 7cc5cdb8b..a23ddcf35 100644 --- a/app/views/ShareView/index.tsx +++ b/app/views/ShareView/index.tsx @@ -11,8 +11,8 @@ import { themes } from '../../lib/constants'; import I18n from '../../i18n'; import Loading from '../../containers/Loading'; import * as HeaderButton from '../../containers/HeaderButton'; -import { isBlocked } from '../../utils/room'; -import { isReadOnly } from '../../utils/isReadOnly'; +import { isBlocked } from '../../lib/methods/helpers/room'; +import { isReadOnly } from '../../lib/methods/helpers/isReadOnly'; import { TSupportedThemes, withTheme } from '../../theme'; import FormTextInput from '../../containers/TextInput/FormTextInput'; import MessageBox from '../../containers/MessageBox'; @@ -20,14 +20,14 @@ import SafeAreaView from '../../containers/SafeAreaView'; import { getUserSelector } from '../../selectors/login'; import StatusBar from '../../containers/StatusBar'; import database from '../../lib/database'; -import { canUploadFile } from '../../utils/media'; -import { isAndroid } from '../../utils/deviceInfo'; +import { canUploadFile } from '../../lib/methods/helpers/media'; import Thumbs from './Thumbs'; import Preview from './Preview'; import Header from './Header'; import styles from './styles'; import { IApplicationState, IServer, IShareAttachment, IUser, TSubscriptionModel, TThreadModel } from '../../definitions'; -import { hasPermission, sendFileMessage, sendMessage } from '../../lib/methods'; +import { sendFileMessage, sendMessage } from '../../lib/methods'; +import { hasPermission, isAndroid } from '../../lib/methods/helpers'; interface IShareViewState { selected: IShareAttachment; diff --git a/app/views/ShareView/utils.ts b/app/views/ShareView/utils.ts index fa6150411..bcc257dee 100644 --- a/app/views/ShareView/utils.ts +++ b/app/views/ShareView/utils.ts @@ -1,4 +1,4 @@ -import { isAndroid } from '../../utils/deviceInfo'; +import { isAndroid } from '../../lib/methods/helpers'; // Limit preview to 3MB on iOS share extension export const allowPreview = (isShareExtension: boolean, size: number): boolean => diff --git a/app/views/SidebarView/SidebarItem.tsx b/app/views/SidebarView/SidebarItem.tsx index 6879fd6bf..301c97610 100644 --- a/app/views/SidebarView/SidebarItem.tsx +++ b/app/views/SidebarView/SidebarItem.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Text, View } from 'react-native'; -import Touch from '../../utils/touch'; +import Touch from '../../lib/methods/helpers/touch'; import { themes } from '../../lib/constants'; import { TSupportedThemes, withTheme } from '../../theme'; import styles from './styles'; diff --git a/app/views/SidebarView/index.tsx b/app/views/SidebarView/index.tsx index 70a46f388..082d7a540 100644 --- a/app/views/SidebarView/index.tsx +++ b/app/views/SidebarView/index.tsx @@ -7,9 +7,9 @@ import { dequal } from 'dequal'; import Avatar from '../../containers/Avatar'; import Status from '../../containers/Status/Status'; -import { events, logEvent } from '../../utils/log'; +import { events, logEvent } from '../../lib/methods/helpers/log'; import I18n from '../../i18n'; -import scrollPersistTaps from '../../utils/scrollPersistTaps'; +import scrollPersistTaps from '../../lib/methods/helpers/scrollPersistTaps'; import { CustomIcon } from '../../containers/CustomIcon'; import { themes } from '../../lib/constants'; import { TSupportedThemes, withTheme } from '../../theme'; diff --git a/app/views/StatusView/index.tsx b/app/views/StatusView/index.tsx index e64d1f435..0bc7eac42 100644 --- a/app/views/StatusView/index.tsx +++ b/app/views/StatusView/index.tsx @@ -16,8 +16,8 @@ import { showToast } from '../../lib/methods/helpers/showToast'; import { Services } from '../../lib/services'; import { getUserSelector } from '../../selectors/login'; import { useTheme } from '../../theme'; -import { showErrorAlert } from '../../utils/info'; -import log, { events, logEvent } from '../../utils/log'; +import { showErrorAlert } from '../../lib/methods/helpers'; +import log, { events, logEvent } from '../../lib/methods/helpers/log'; interface IStatus { id: TUserStatus; diff --git a/app/views/TeamChannelsView.tsx b/app/views/TeamChannelsView.tsx index 5b337b766..752bcc90a 100644 --- a/app/views/TeamChannelsView.tsx +++ b/app/views/TeamChannelsView.tsx @@ -27,12 +27,10 @@ import RoomItem, { ROW_HEIGHT } from '../containers/RoomItem'; import { getUserSelector } from '../selectors/login'; import { ChatsStackParamList } from '../stacks/types'; import { withTheme } from '../theme'; -import debounce from '../utils/debounce'; -import { isIOS } from '../utils/deviceInfo'; -import { goRoom } from '../utils/goRoom'; -import { showErrorAlert } from '../utils/info'; -import log, { events, logEvent } from '../utils/log'; -import { getRoomAvatar, getRoomTitle, hasPermission } from '../lib/methods'; +import { goRoom } from '../lib/methods/helpers/goRoom'; +import { showErrorAlert } from '../lib/methods/helpers/info'; +import log, { events, logEvent } from '../lib/methods/helpers/log'; +import { getRoomAvatar, getRoomTitle, hasPermission, debounce, isIOS } from '../lib/methods/helpers'; import { Services } from '../lib/services'; const API_FETCH_COUNT = 25; diff --git a/app/views/ThemeView.tsx b/app/views/ThemeView.tsx index c59d54bf4..46b49e204 100644 --- a/app/views/ThemeView.tsx +++ b/app/views/ThemeView.tsx @@ -5,10 +5,10 @@ import I18n from '../i18n'; import { useTheme } from '../theme'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; -import { supportSystemTheme } from '../utils/deviceInfo'; +import { supportSystemTheme } from '../lib/methods/helpers'; import SafeAreaView from '../containers/SafeAreaView'; import UserPreferences from '../lib/methods/userPreferences'; -import { events, logEvent } from '../utils/log'; +import { events, logEvent } from '../lib/methods/helpers/log'; import { IThemePreference, TThemeMode, TDarkLevel } from '../definitions/ITheme'; import { THEME_PREFERENCES_KEY, themes } from '../lib/constants'; import { IBaseScreen } from '../definitions'; diff --git a/app/views/ThreadMessagesView/Dropdown/DropdownItem.tsx b/app/views/ThreadMessagesView/Dropdown/DropdownItem.tsx index c1ac5357f..01943e64b 100644 --- a/app/views/ThreadMessagesView/Dropdown/DropdownItem.tsx +++ b/app/views/ThreadMessagesView/Dropdown/DropdownItem.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { useTheme } from '../../../theme'; -import Touch from '../../../utils/touch'; +import Touch from '../../../lib/methods/helpers/touch'; import { CustomIcon, TIconsName } from '../../../containers/CustomIcon'; import sharedStyles from '../../Styles'; diff --git a/app/views/ThreadMessagesView/Item.tsx b/app/views/ThreadMessagesView/Item.tsx index fb6c863eb..3321cde65 100644 --- a/app/views/ThreadMessagesView/Item.tsx +++ b/app/views/ThreadMessagesView/Item.tsx @@ -7,7 +7,7 @@ import Avatar from '../../containers/Avatar'; import sharedStyles from '../Styles'; import { themes } from '../../lib/constants'; import { MarkdownPreview } from '../../containers/markdown'; -import { formatDateThreads, makeThreadName } from '../../utils/room'; +import { formatDateThreads, makeThreadName } from '../../lib/methods/helpers/room'; import ThreadDetails from '../../containers/ThreadDetails'; import { TThreadModel } from '../../definitions'; diff --git a/app/views/ThreadMessagesView/index.tsx b/app/views/ThreadMessagesView/index.tsx index 925e9e2b1..d49f0c19d 100644 --- a/app/views/ThreadMessagesView/index.tsx +++ b/app/views/ThreadMessagesView/index.tsx @@ -14,8 +14,7 @@ import database from '../../lib/database'; import { sanitizeLikeString } from '../../lib/database/utils'; import StatusBar from '../../containers/StatusBar'; import buildMessage from '../../lib/methods/helpers/buildMessage'; -import log from '../../utils/log'; -import debounce from '../../utils/debounce'; +import log from '../../lib/methods/helpers/log'; import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import { themes } from '../../lib/constants'; import { TSupportedThemes, withTheme } from '../../theme'; @@ -24,10 +23,9 @@ import SafeAreaView from '../../containers/SafeAreaView'; import * as HeaderButton from '../../containers/HeaderButton'; import * as List from '../../containers/List'; import BackgroundContainer from '../../containers/BackgroundContainer'; -import { isIOS } from '../../utils/deviceInfo'; -import { getBadgeColor, makeThreadName } from '../../utils/room'; +import { getBadgeColor, makeThreadName } from '../../lib/methods/helpers/room'; import { getHeaderTitlePosition } from '../../containers/Header'; -import EventEmitter from '../../utils/events'; +import EventEmitter from '../../lib/methods/helpers/events'; import { LISTENER } from '../../containers/Toast'; import SearchHeader from '../../containers/SearchHeader'; import { ChatsStackParamList } from '../../stacks/types'; @@ -37,7 +35,7 @@ import Dropdown from './Dropdown'; import Item from './Item'; import styles from './styles'; import { IApplicationState, IBaseScreen, IMessage, SubscriptionType, TSubscriptionModel, TThreadModel } from '../../definitions'; -import { getUidDirectMessage } from '../../lib/methods'; +import { getUidDirectMessage, debounce, isIOS } from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; const API_FETCH_COUNT = 50; diff --git a/app/views/UserPreferencesView/index.tsx b/app/views/UserPreferencesView/index.tsx index bb6b45dcd..e206f1e2d 100644 --- a/app/views/UserPreferencesView/index.tsx +++ b/app/views/UserPreferencesView/index.tsx @@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux'; import { setUser } from '../../actions/login'; import I18n from '../../i18n'; -import log, { logEvent, events } from '../../utils/log'; +import log, { logEvent, events } from '../../lib/methods/helpers/log'; import SafeAreaView from '../../containers/SafeAreaView'; import StatusBar from '../../containers/StatusBar'; import * as List from '../../containers/List'; diff --git a/app/views/WorkspaceView/ServerAvatar.tsx b/app/views/WorkspaceView/ServerAvatar.tsx index bdbb9b58a..7d3da01f6 100644 --- a/app/views/WorkspaceView/ServerAvatar.tsx +++ b/app/views/WorkspaceView/ServerAvatar.tsx @@ -6,7 +6,7 @@ import FastImage from 'react-native-fast-image'; import sharedStyles from '../Styles'; import { themes } from '../../lib/constants'; -import { isTablet } from '../../utils/deviceInfo'; +import { isTablet } from '../../lib/methods/helpers'; import { TSupportedThemes } from '../../theme'; const ImageProgress = createImageProgress(FastImage);