diff --git a/app/AppContainer.tsx b/app/AppContainer.tsx index 51ccba5f7..9edbce6d8 100644 --- a/app/AppContainer.tsx +++ b/app/AppContainer.tsx @@ -6,15 +6,12 @@ import { connect } from 'react-redux'; import Navigation from './lib/Navigation'; import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation'; import { - ROOT_LOADING, ROOT_OUTSIDE, ROOT_NEW_SERVER, ROOT_INSIDE, ROOT_SET_USERNAME + ROOT_INSIDE, ROOT_LOADING, ROOT_NEW_SERVER, ROOT_OUTSIDE, ROOT_SET_USERNAME, } from './actions/app'; - // Stacks import AuthLoadingView from './views/AuthLoadingView'; - // SetUsername Stack import SetUsernameView from './views/SetUsernameView'; - import OutsideStack from './stacks/OutsideStack'; import InsideStack from './stacks/InsideStack'; import MasterDetailStack from './stacks/MasterDetailStack'; @@ -101,7 +98,7 @@ const App = React.memo(({ root, isMasterDetail }: {root: string, isMasterDetail: }); const mapStateToProps = (state: any) => ({ root: state.app.root, - isMasterDetail: state.app.isMasterDetail + isMasterDetail: state.app.isMasterDetail, }); const AppContainer = connect(mapStateToProps)(App); diff --git a/app/actions/actionsTypes.js b/app/actions/actionsTypes.js index 0790b7bad..ea725988b 100644 --- a/app/actions/actionsTypes.js +++ b/app/actions/actionsTypes.js @@ -4,7 +4,7 @@ const FAILURE = 'FAILURE'; const defaultTypes = [REQUEST, SUCCESS, FAILURE]; function createRequestTypes(base, types = defaultTypes) { const res = {}; - types.forEach(type => (res[type] = `${ base }_${ type }`)); + types.forEach(type => res[type] = `${ base }_${ type }`); return res; } diff --git a/app/commands.js b/app/commands.js index c0f4c5575..3f0f6f766 100644 --- a/app/commands.js +++ b/app/commands.js @@ -125,15 +125,15 @@ const keyCommands = [ discoverabilityTitle: I18n.t('Add_server') }, // Refers to select rooms on list - ...([1, 2, 3, 4, 5, 6, 7, 8, 9].map(value => ({ + ...[1, 2, 3, 4, 5, 6, 7, 8, 9].map(value => ({ input: `${ value }`, modifierFlags: constants.keyModifierCommand - }))), + })), // Refers to select servers on list - ...([1, 2, 3, 4, 5, 6, 7, 8, 9].map(value => ({ + ...[1, 2, 3, 4, 5, 6, 7, 8, 9].map(value => ({ input: `${ value }`, modifierFlags: constants.keyModifierCommand | constants.keyModifierAlternate - }))) + })) ]; export const setKeyCommands = () => KeyCommands.setKeyCommands(keyCommands); diff --git a/app/constants/colors.ts b/app/constants/colors.ts index ab358679c..6fc484523 100644 --- a/app/constants/colors.ts +++ b/app/constants/colors.ts @@ -3,12 +3,12 @@ export const STATUS_COLORS: any = { busy: '#f5455c', away: '#ffd21f', offline: '#cbced1', - loading: '#9ea2a8' + loading: '#9ea2a8', }; export const SWITCH_TRACK_COLOR = { false: '#f5455c', - true: '#2de0a5' + true: '#2de0a5', }; const mentions = { @@ -16,7 +16,7 @@ const mentions = { tunreadColor: '#1d74f5', mentionMeColor: '#F5455C', mentionGroupColor: '#F38C39', - mentionOtherColor: '#F3BE08' + mentionOtherColor: '#F3BE08', }; export const themes: any = { @@ -65,7 +65,7 @@ export const themes: any = { previewBackground: '#1F2329', previewTintColor: '#ffffff', backdropOpacity: 0.3, - ...mentions + ...mentions, }, dark: { backgroundColor: '#030b1b', @@ -112,7 +112,7 @@ export const themes: any = { previewBackground: '#030b1b', previewTintColor: '#ffffff', backdropOpacity: 0.9, - ...mentions + ...mentions, }, black: { backgroundColor: '#000000', @@ -159,6 +159,6 @@ export const themes: any = { previewBackground: '#000000', previewTintColor: '#ffffff', backdropOpacity: 0.9, - ...mentions - } + ...mentions, + }, }; diff --git a/app/constants/messagesStatus.ts b/app/constants/messagesStatus.ts index 4f945f939..b27260d72 100644 --- a/app/constants/messagesStatus.ts +++ b/app/constants/messagesStatus.ts @@ -1,5 +1,5 @@ export default { SENT: 0, TEMP: 1, - ERROR: 2 + ERROR: 2, }; diff --git a/app/constants/settings.ts b/app/constants/settings.ts index 14ad8fb36..62fff6319 100644 --- a/app/constants/settings.ts +++ b/app/constants/settings.ts @@ -1,206 +1,206 @@ export default { Accounts_AllowEmailChange: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AllowPasswordChange: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AllowRealNameChange: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AllowUserAvatarChange: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AllowUserProfileChange: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AllowUserStatusMessageChange: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AllowUsernameChange: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AvatarBlockUnauthenticatedAccess: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_CustomFields: { - type: 'valueAsString' + type: 'valueAsString', }, Accounts_EmailOrUsernamePlaceholder: { - type: 'valueAsString' + type: 'valueAsString', }, Accounts_EmailVerification: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_NamePlaceholder: { - type: 'valueAsString' + type: 'valueAsString', }, Accounts_PasswordPlaceholder: { - type: 'valueAsString' + type: 'valueAsString', }, Accounts_PasswordReset: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_RegistrationForm: { - type: 'valueAsString' + type: 'valueAsString', }, Accounts_RegistrationForm_LinkReplacementText: { - type: 'valueAsString' + type: 'valueAsString', }, Accounts_ShowFormLogin: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_ManuallyApproveNewUsers: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, API_Use_REST_For_DDP_Calls: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_iframe_enabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_Iframe_api_url: { - type: 'valueAsString' + type: 'valueAsString', }, Accounts_Iframe_api_method: { - type: 'valueAsString' + type: 'valueAsString', }, CROWD_Enable: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, DirectMesssage_maxUsers: { - type: 'valueAsNumber' + type: 'valueAsNumber', }, E2E_Enable: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_Directory_DefaultView: { - type: 'valueAsString' + type: 'valueAsString', }, FEDERATION_Enabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Hide_System_Messages: { - type: 'valueAsArray' + type: 'valueAsArray', }, LDAP_Enable: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Livechat_request_comment_when_closing_conversation: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Jitsi_Enabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Jitsi_SSL: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Jitsi_Domain: { - type: 'valueAsString' + type: 'valueAsString', }, Jitsi_Enabled_TokenAuth: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Jitsi_URL_Room_Hash: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Jitsi_URL_Room_Prefix: { - type: 'valueAsString' + type: 'valueAsString', }, Message_AllowDeleting: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Message_AllowDeleting_BlockDeleteInMinutes: { - type: 'valueAsNumber' + type: 'valueAsNumber', }, Message_AllowEditing: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Message_AllowEditing_BlockEditInMinutes: { - type: 'valueAsNumber' + type: 'valueAsNumber', }, Message_AllowPinning: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Message_AllowStarring: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Message_AudioRecorderEnabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Message_GroupingPeriod: { - type: 'valueAsNumber' + type: 'valueAsNumber', }, Message_TimeFormat: { - type: 'valueAsString' + type: 'valueAsString', }, Message_TimeAndDateFormat: { - type: 'valueAsString' + type: 'valueAsString', }, Site_Name: { - type: 'valueAsString' + type: 'valueAsString', }, Site_Url: { - type: 'valueAsString' + type: 'valueAsString', }, Store_Last_Message: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, uniqueID: { - type: 'valueAsString' + type: 'valueAsString', }, UI_Allow_room_names_with_special_chars: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, UI_Use_Real_Name: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Assets_favicon_512: { - type: null + type: null, }, Message_Read_Receipt_Enabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Message_Read_Receipt_Store_Users: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Threads_enabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, FileUpload_MediaTypeWhiteList: { - type: 'valueAsString' + type: 'valueAsString', }, FileUpload_MaxFileSize: { - type: 'valueAsNumber' + type: 'valueAsNumber', }, API_Gitlab_URL: { - type: 'valueAsString' + type: 'valueAsString', }, AutoTranslate_Enabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, CAS_enabled: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, CAS_login_url: { - type: 'valueAsString' + type: 'valueAsString', }, Force_Screen_Lock: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Force_Screen_Lock_After: { - type: 'valueAsNumber' + type: 'valueAsNumber', }, Allow_Save_Media_to_Gallery: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Accounts_AllowInvisibleStatusOption: { - type: 'valueAsString' + type: 'valueAsString', }, Jitsi_Enable_Teams: { - type: 'valueAsBoolean' + type: 'valueAsBoolean', }, Jitsi_Enable_Channels: { - type: 'valuesAsBoolean' - } + type: 'valuesAsBoolean', + }, }; diff --git a/app/containers/ActionSheet/ActionSheet.tsx b/app/containers/ActionSheet/ActionSheet.tsx index e7c1173b2..7332643e6 100644 --- a/app/containers/ActionSheet/ActionSheet.tsx +++ b/app/containers/ActionSheet/ActionSheet.tsx @@ -1,17 +1,17 @@ import React, { + forwardRef, + isValidElement, + useCallback, + useEffect, + useImperativeHandle, useRef, useState, - useEffect, - forwardRef, - useImperativeHandle, - useCallback, - isValidElement } from 'react'; import { Keyboard, Text } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; -import { TapGestureHandler, State } from 'react-native-gesture-handler'; +import { State, TapGestureHandler } from 'react-native-gesture-handler'; import ScrollBottomSheet from 'react-native-scroll-bottom-sheet'; -import Animated, { Extrapolate, interpolate, Value, Easing} from 'react-native-reanimated'; +import Animated, { Easing, Extrapolate, Value, interpolate } from 'react-native-reanimated'; import * as Haptics from 'expo-haptics'; import { useBackHandler } from '@react-native-community/hooks'; @@ -20,10 +20,10 @@ import { Handle } from './Handle'; import { Button } from './Button'; import { themes } from '../../constants/colors'; import styles, { ITEM_HEIGHT } from './styles'; -import { isTablet, isIOS } from '../../utils/deviceInfo'; +import { isIOS, isTablet } from '../../utils/deviceInfo'; import * as List from '../List'; import I18n from '../../i18n'; -import { useOrientation, useDimensions, IDimensionsContextProps } from '../../dimensions'; +import { IDimensionsContextProps, useDimensions, useOrientation } from '../../dimensions'; interface IActionSheetData { options: any; @@ -43,7 +43,7 @@ const ANIMATION_DURATION = 250; const ANIMATION_CONFIG = { duration: ANIMATION_DURATION, // https://easings.net/#easeInOutCubic - easing: Easing.bezier(0.645, 0.045, 0.355, 1.0) + easing: Easing.bezier(0.645, 0.045, 0.355, 1.0), }; const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.Element; theme: string}, ref) => { @@ -55,8 +55,8 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E const insets = useSafeAreaInsets(); const maxSnap = Math.max( - ( - height! + + height! // Items height - (ITEM_HEIGHT * (data?.options?.length || 0)) // Handle height @@ -67,8 +67,8 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E - insets.bottom // Cancel button height - (data?.hasCancel ? CANCEL_HEIGHT : 0) - ), - MAX_SNAP_HEIGHT + , + MAX_SNAP_HEIGHT, ); /* @@ -121,7 +121,7 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E useImperativeHandle(ref, () => ({ showActionSheet: show, - hideActionSheet: hide + hideActionSheet: hide, })); const renderHandle = useCallback(() => ( @@ -149,7 +149,7 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E const opacity = interpolate(animatedPosition.current, { inputRange: [0, 1], outputRange: [0, themes[theme].backdropOpacity], - extrapolate: Extrapolate.CLAMP + extrapolate: Extrapolate.CLAMP, }); return ( @@ -164,8 +164,8 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E styles.backdrop, { backgroundColor: themes[theme].backdropColor, - opacity - } + opacity, + }, ]} /> @@ -176,12 +176,12 @@ const ActionSheet = React.memo(forwardRef(({ children, theme }: {children: JSX.E snapPoints={snaps} initialSnapIndex={closedSnapIndex} renderHandle={renderHandle} - onSettle={index => (index === closedSnapIndex) && toggleVisible()} + onSettle={(index) => (index === closedSnapIndex) && toggleVisible()} animatedPosition={animatedPosition.current} containerStyle={[ styles.container, { backgroundColor: themes[theme].focusedBackground }, - (isLandscape || isTablet) && styles.bottomSheet + (isLandscape || isTablet) && styles.bottomSheet, ] as any} animationConfig={ANIMATION_CONFIG} // FlatList props diff --git a/app/containers/ActionSheet/Provider.tsx b/app/containers/ActionSheet/Provider.tsx index c8715b613..49239ddc7 100644 --- a/app/containers/ActionSheet/Provider.tsx +++ b/app/containers/ActionSheet/Provider.tsx @@ -1,4 +1,4 @@ -import React, {useRef, useContext, forwardRef, ForwardedRef} from 'react'; +import React, { ForwardedRef, forwardRef, useContext, useRef } from 'react'; import ActionSheet from './ActionSheet'; import { useTheme } from '../../theme'; @@ -10,7 +10,7 @@ interface IActionSheetProvider { const context: IActionSheetProvider = React.createContext({ showActionSheet: () => {}, - hideActionSheet: () => {} + hideActionSheet: () => {}, }); export const useActionSheet = () => useContext(context); @@ -33,7 +33,7 @@ export const ActionSheetProvider = React.memo(({ children }: {children: JSX.Elem }, hideActionSheet: () => { ref.current?.hideActionSheet(); - } + }, }); return ( diff --git a/app/containers/ActionSheet/styles.ts b/app/containers/ActionSheet/styles.ts index 1b9397dc9..12143312e 100644 --- a/app/containers/ActionSheet/styles.ts +++ b/app/containers/ActionSheet/styles.ts @@ -8,46 +8,46 @@ export default StyleSheet.create({ container: { overflow: 'hidden', borderTopLeftRadius: 16, - borderTopRightRadius: 16 + borderTopRightRadius: 16, }, item: { paddingHorizontal: 16, height: ITEM_HEIGHT, alignItems: 'center', - flexDirection: 'row' + flexDirection: 'row', }, separator: { - marginHorizontal: 16 + marginHorizontal: 16, }, content: { - paddingTop: 16 + paddingTop: 16, }, titleContainer: { - flex: 1 + flex: 1, }, title: { fontSize: 16, marginLeft: 16, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, handle: { justifyContent: 'center', alignItems: 'center', - paddingBottom: 8 + paddingBottom: 8, }, handleIndicator: { width: 40, height: 4, borderRadius: 4, - margin: 8 + margin: 8, }, backdrop: { - ...StyleSheet.absoluteFillObject + ...StyleSheet.absoluteFillObject, }, bottomSheet: { width: '50%', alignSelf: 'center', - left: '25%' + left: '25%', }, button: { marginHorizontal: 16, @@ -55,14 +55,14 @@ export default StyleSheet.create({ justifyContent: 'center', height: ITEM_HEIGHT, borderRadius: 2, - marginBottom: 12 + marginBottom: 12, }, text: { fontSize: 16, ...sharedStyles.textMedium, - ...sharedStyles.textAlignCenter + ...sharedStyles.textAlignCenter, }, rightContainer: { - paddingLeft: 12 - } + paddingLeft: 12, + }, }); diff --git a/app/containers/ActivityIndicator.tsx b/app/containers/ActivityIndicator.tsx index e2f1de935..5153a99e3 100644 --- a/app/containers/ActivityIndicator.tsx +++ b/app/containers/ActivityIndicator.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { ActivityIndicator, ActivityIndicatorProps, StyleSheet } from 'react-native'; + import { themes } from '../constants/colors'; type TTheme = 'light' | 'dark' | 'black' | string; @@ -13,7 +14,7 @@ interface IActivityIndicator extends ActivityIndicatorProps{ const styles = StyleSheet.create({ indicator: { padding: 16, - flex: 1 + flex: 1, }, absolute: { position: 'absolute', @@ -22,8 +23,8 @@ const styles = StyleSheet.create({ top: 0, bottom: 0, alignItems: 'center', - justifyContent: 'center' - } + justifyContent: 'center', + }, }); const RCActivityIndicator = ({ theme = 'light', absolute, ...props }: IActivityIndicator) => ( diff --git a/app/containers/AppVersion.tsx b/app/containers/AppVersion.tsx index 69ea69064..a6748e2d7 100644 --- a/app/containers/AppVersion.tsx +++ b/app/containers/AppVersion.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { StyleSheet, View, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import { themes } from '../constants/colors'; import sharedStyles from '../views/Styles'; @@ -9,15 +9,15 @@ import I18n from '../i18n'; const styles = StyleSheet.create({ container: { alignItems: 'center', - justifyContent: 'flex-end' + justifyContent: 'flex-end', }, text: { ...sharedStyles.textRegular, - fontSize: 13 + fontSize: 13, }, bold: { - ...sharedStyles.textSemibold - } + ...sharedStyles.textSemibold, + }, }); const AppVersion = React.memo(({ theme }: {theme: string}) => ( diff --git a/app/containers/Avatar/Avatar.tsx b/app/containers/Avatar/Avatar.tsx index 7b78bd19c..b7216f5a2 100644 --- a/app/containers/Avatar/Avatar.tsx +++ b/app/containers/Avatar/Avatar.tsx @@ -6,11 +6,11 @@ import { settings as RocketChatSettings } from '@rocket.chat/sdk'; import { avatarURL } from '../../utils/avatar'; import Emoji from '../markdown/Emoji'; -import {IAvatar} from './interfaces'; +import { IAvatar } from './interfaces'; const Avatar = React.memo(({ server, - style, + style, avatar, children, user, @@ -23,12 +23,11 @@ const Avatar = React.memo(({ rid, blockUnauthenticatedAccess, serverVersion, - text, - size = 25, - borderRadius = 4, - type = 'd', + text, + size = 25, + borderRadius = 4, + type = 'd', }: Partial) => { - if ((!text && !avatar && !emoji && !rid) || !server) { return null; } @@ -36,7 +35,7 @@ const Avatar = React.memo(({ const avatarStyle = { width: size, height: size, - borderRadius + borderRadius, }; let image; @@ -64,7 +63,7 @@ const Avatar = React.memo(({ avatarETag, serverVersion, rid, - blockUnauthenticatedAccess + blockUnauthenticatedAccess, }); } @@ -74,7 +73,7 @@ const Avatar = React.memo(({ source={{ uri, headers: RocketChatSettings.customHeaders, - priority: FastImage.priority.high + priority: FastImage.priority.high, }} /> ); diff --git a/app/containers/Avatar/index.tsx b/app/containers/Avatar/index.tsx index 55e503b22..ddbefd7e5 100644 --- a/app/containers/Avatar/index.tsx +++ b/app/containers/Avatar/index.tsx @@ -5,16 +5,16 @@ import { Q } from '@nozbe/watermelondb'; import database from '../../lib/database'; import { getUserSelector } from '../../selectors/login'; import Avatar from './Avatar'; -import {IAvatar} from "./interfaces"; - +import { IAvatar } from './interfaces'; class AvatarContainer extends React.Component, any> { private mounted: boolean; + private subscription!: any; static defaultProps = { text: '', - type: 'd' + type: 'd', }; constructor(props: Partial) { @@ -46,7 +46,7 @@ class AvatarContainer extends React.Component, any> { return type === 'd'; } - init = async() => { + init = async () => { const db = database.active; const usersCollection = db.get('users'); const subsCollection = db.get('subscriptions'); @@ -99,6 +99,6 @@ const mapStateToProps = (state: any) => ({ blockUnauthenticatedAccess: state.share.settings?.Accounts_AvatarBlockUnauthenticatedAccess ?? state.settings.Accounts_AvatarBlockUnauthenticatedAccess - ?? true + ?? true, }); export default connect(mapStateToProps)(AvatarContainer); diff --git a/app/containers/Avatar/interfaces.ts b/app/containers/Avatar/interfaces.ts index 966202ea7..e759b16b7 100644 --- a/app/containers/Avatar/interfaces.ts +++ b/app/containers/Avatar/interfaces.ts @@ -1,23 +1,23 @@ export interface IAvatar { - server: string; - style: any, - text: string; - avatar: string; - emoji: string; - size: number; - borderRadius: number; - type: string; - children: JSX.Element; - user: { - id: string; - token: string; - }; - theme: string; - onPress(): void; - getCustomEmoji(): any; - avatarETag: string; - isStatic: boolean; - rid: string; - blockUnauthenticatedAccess: boolean; - serverVersion: string; + server: string; + style: any, + text: string; + avatar: string; + emoji: string; + size: number; + borderRadius: number; + type: string; + children: JSX.Element; + user: { + id: string; + token: string; + }; + theme: string; + onPress(): void; + getCustomEmoji(): any; + avatarETag: string; + isStatic: boolean; + rid: string; + blockUnauthenticatedAccess: boolean; + serverVersion: string; } diff --git a/app/containers/BackgroundContainer/index.stories.js b/app/containers/BackgroundContainer/index.stories.js index 0b6c9a1c6..0a9228dfa 100644 --- a/app/containers/BackgroundContainer/index.stories.js +++ b/app/containers/BackgroundContainer/index.stories.js @@ -2,9 +2,9 @@ import React from 'react'; import { storiesOf } from '@storybook/react-native'; -import BackgroundContainer from '.'; import { ThemeContext } from '../../theme'; import { longText } from '../../../storybook/utils'; +import BackgroundContainer from '.'; const stories = storiesOf('BackgroundContainer', module); diff --git a/app/containers/BackgroundContainer/index.tsx b/app/containers/BackgroundContainer/index.tsx index 21324d791..d8ee23b09 100644 --- a/app/containers/BackgroundContainer/index.tsx +++ b/app/containers/BackgroundContainer/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { ImageBackground, StyleSheet, Text, View, ActivityIndicator } from 'react-native'; +import { ActivityIndicator, ImageBackground, StyleSheet, Text, View } from 'react-native'; import { withTheme } from '../../theme'; import sharedStyles from '../../views/Styles'; @@ -13,12 +13,12 @@ interface IBackgroundContainer { const styles = StyleSheet.create({ container: { - flex: 1 + flex: 1, }, image: { width: '100%', height: '100%', - position: 'absolute' + position: 'absolute', }, text: { position: 'absolute', @@ -28,15 +28,15 @@ const styles = StyleSheet.create({ fontSize: 16, paddingHorizontal: 24, ...sharedStyles.textRegular, - ...sharedStyles.textAlignCenter - } + ...sharedStyles.textAlignCenter, + }, }); const BackgroundContainer = ({ theme, text, loading }: IBackgroundContainer) => ( {text ? {text} : null} - {/*@ts-ignore*/} + {/* @ts-ignore*/} {loading ? : null} ); diff --git a/app/containers/Button/index.tsx b/app/containers/Button/index.tsx index 3ff63f5c0..81b49fe0e 100644 --- a/app/containers/Button/index.tsx +++ b/app/containers/Button/index.tsx @@ -26,26 +26,25 @@ const styles = StyleSheet.create({ justifyContent: 'center', height: 48, borderRadius: 2, - marginBottom: 12 + marginBottom: 12, }, text: { fontSize: 16, ...sharedStyles.textMedium, - ...sharedStyles.textAlignCenter + ...sharedStyles.textAlignCenter, }, disabled: { - opacity: 0.3 - } + opacity: 0.3, + }, }); export default class Button extends React.PureComponent, any> { - static defaultProps = { title: 'Press me!', type: 'primary', onPress: () => alert('It works!'), disabled: false, - loading: false + loading: false, } render() { @@ -69,7 +68,7 @@ export default class Button extends React.PureComponent, a ? { backgroundColor } : { backgroundColor: isPrimary ? themes[theme!].actionTintColor : themes[theme!].backgroundColor }, disabled && styles.disabled, - style + style, ]} {...otherProps} > @@ -81,7 +80,7 @@ export default class Button extends React.PureComponent, a style={[ styles.text, { color: textColor }, - fontSize && { fontSize } + fontSize && { fontSize }, ]} accessibilityLabel={title} > diff --git a/app/containers/Check.tsx b/app/containers/Check.tsx index 4034dfd26..8142f049d 100644 --- a/app/containers/Check.tsx +++ b/app/containers/Check.tsx @@ -12,8 +12,8 @@ const styles = StyleSheet.create({ icon: { width: 22, height: 22, - marginHorizontal: 15 - } + marginHorizontal: 15, + }, }); const Check = React.memo(({ theme, style }: ICheck) => ); diff --git a/app/containers/EmojiPicker/CustomEmoji.tsx b/app/containers/EmojiPicker/CustomEmoji.tsx index 6fda1a706..08cb3f5b4 100644 --- a/app/containers/EmojiPicker/CustomEmoji.tsx +++ b/app/containers/EmojiPicker/CustomEmoji.tsx @@ -1,13 +1,14 @@ import React from 'react'; import FastImage from '@rocket.chat/react-native-fast-image'; -import {ICustomEmoji} from "./interfaces"; + +import { ICustomEmoji } from './interfaces'; const CustomEmoji = React.memo(({ baseUrl, emoji, style }: ICustomEmoji) => ( diff --git a/app/containers/EmojiPicker/EmojiCategory.tsx b/app/containers/EmojiPicker/EmojiCategory.tsx index 436f9c4ce..4fdef75ec 100644 --- a/app/containers/EmojiPicker/EmojiCategory.tsx +++ b/app/containers/EmojiPicker/EmojiCategory.tsx @@ -1,11 +1,11 @@ import React from 'react'; -import { Text, TouchableOpacity, FlatList } from 'react-native'; +import { FlatList, Text, TouchableOpacity } from 'react-native'; import shortnameToUnicode from '../../utils/shortnameToUnicode'; import styles from './styles'; import CustomEmoji from './CustomEmoji'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; -import {IEmoji, IEmojiCategory} from "./interfaces"; +import { IEmoji, IEmojiCategory } from './interfaces'; const EMOJI_SIZE = 50; @@ -21,7 +21,6 @@ const renderEmoji = (emoji: IEmoji, size: number, baseUrl: string) => { }; class EmojiCategory extends React.Component> { - renderItem(emoji: any) { const { baseUrl, onEmojiSelected } = this.props; return ( @@ -52,7 +51,7 @@ class EmojiCategory extends React.Component> { contentContainerStyle={{ marginHorizontal }} // rerender FlatList in case of width changes key={`emoji-category-${ width }`} - keyExtractor={item => (item && item.isCustom && item.content) || item} + keyExtractor={(item) => (item && item.isCustom && item.content) || item} data={emojis} extraData={this.props} renderItem={({ item }) => this.renderItem(item)} diff --git a/app/containers/EmojiPicker/TabBar.tsx b/app/containers/EmojiPicker/TabBar.tsx index aa07f9559..5d521cc7b 100644 --- a/app/containers/EmojiPicker/TabBar.tsx +++ b/app/containers/EmojiPicker/TabBar.tsx @@ -1,10 +1,11 @@ import React from 'react'; -import { View, TouchableOpacity, Text } from 'react-native'; +import { Text, TouchableOpacity, View } from 'react-native'; + import styles from './styles'; import { themes } from '../../constants/colors'; interface ITabBarProps { - goToPage({}): void; + goToPage: Function; activeTab: number, tabs: [], tabEmojiStyle: object, @@ -12,7 +13,6 @@ interface ITabBarProps { } export default class TabBar extends React.Component> { - shouldComponentUpdate(nextProps: any) { const { activeTab, theme } = this.props; if (nextProps.activeTab !== activeTab) { diff --git a/app/containers/EmojiPicker/categories.ts b/app/containers/EmojiPicker/categories.ts index a95f67cf6..982f1d668 100644 --- a/app/containers/EmojiPicker/categories.ts +++ b/app/containers/EmojiPicker/categories.ts @@ -2,43 +2,43 @@ const list = ['frequentlyUsed', 'custom', 'people', 'nature', 'food', 'activity' const tabs = [ { tabLabel: '🕒', - category: list[0] + category: list[0], }, { tabLabel: '🚀', - category: list[1] + category: list[1], }, { tabLabel: '😃', - category: list[2] + category: list[2], }, { tabLabel: '🐶', - category: list[3] + category: list[3], }, { tabLabel: '🍔', - category: list[4] + category: list[4], }, { tabLabel: '⚽', - category: list[5] + category: list[5], }, { tabLabel: '🚌', - category: list[6] + category: list[6], }, { tabLabel: '💡', - category: list[7] + category: list[7], }, { tabLabel: '💛', - category: list[8] + category: list[8], }, { tabLabel: '🏁', - category: list[9] - } + category: list[9], + }, ]; export default { list, tabs }; diff --git a/app/containers/EmojiPicker/index.tsx b/app/containers/EmojiPicker/index.tsx index bb2d47447..a634b7ff8 100644 --- a/app/containers/EmojiPicker/index.tsx +++ b/app/containers/EmojiPicker/index.tsx @@ -17,11 +17,11 @@ import shortnameToUnicode from '../../utils/shortnameToUnicode'; import log from '../../utils/log'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; -import {IEmoji} from "./interfaces"; +import { IEmoji } from './interfaces'; const scrollProps = { keyboardShouldPersistTaps: 'always', - keyboardDismissMode: 'none' + keyboardDismissMode: 'none', }; interface IEmojiPickerProps { @@ -43,21 +43,20 @@ interface IEmojiPickerState { } class EmojiPicker extends Component { - constructor(props: IEmojiPickerProps) { super(props); const customEmojis = Object.keys(props.customEmojis) - .filter(item => item === props.customEmojis[item].name) - .map(item => ({ + .filter((item) => item === props.customEmojis[item].name) + .map((item) => ({ content: props.customEmojis[item].name, extension: props.customEmojis[item].extension, - isCustom: true + isCustom: true, })); this.state = { frequentlyUsed: [], customEmojis, show: false, - width: null + width: null, }; } @@ -89,7 +88,7 @@ class EmojiPicker extends Component { const { onEmojiSelected } = this.props; if (emoji.isCustom) { this._addFrequentlyUsed({ - content: emoji.content, extension: emoji.extension, isCustom: true + content: emoji.content, extension: emoji.extension, isCustom: true, }); onEmojiSelected!(`:${ emoji.content }:`); } else { @@ -104,7 +103,7 @@ class EmojiPicker extends Component { } // eslint-disable-next-line react/sort-comp - _addFrequentlyUsed = protectedFunction(async(emoji: IEmoji) => { + _addFrequentlyUsed = protectedFunction(async (emoji: IEmoji) => { const db = database.active; const freqEmojiCollection = db.get('frequently_used_emojis'); let freqEmojiRecord: any; @@ -114,7 +113,7 @@ class EmojiPicker extends Component { // Do nothing } - await db.action(async() => { + await db.action(async () => { if (freqEmojiRecord) { await freqEmojiRecord.update((f: any) => { f.count += 1; @@ -129,7 +128,7 @@ class EmojiPicker extends Component { }); }) - updateFrequentlyUsed = async() => { + updateFrequentlyUsed = async () => { const db = database.active; const frequentlyUsedRecords = await db.get('frequently_used_emojis').query().fetch(); let frequentlyUsed: any = orderBy(frequentlyUsedRecords, ['count'], ['desc']); @@ -159,7 +158,7 @@ class EmojiPicker extends Component { return ( this.onEmojiSelected(emoji)} + onEmojiSelected={(emoji) => this.onEmojiSelected(emoji)} style={styles.categoryContainer} width={width!} baseUrl={baseUrl} @@ -179,16 +178,15 @@ class EmojiPicker extends Component { } - /*@ts-ignore*/ + /* @ts-ignore*/ contentProps={scrollProps} style={{ backgroundColor: themes[theme!].focusedBackground }} > { categories.tabs.map((tab, i) => ( - (i === 0 && frequentlyUsed.length === 0) ? null // when no frequentlyUsed don't show the tab - : ( - this.renderCategory(tab.category, i, tab.tabLabel) - ))) + i === 0 && frequentlyUsed.length === 0 ? null // when no frequentlyUsed don't show the tab + : this.renderCategory(tab.category, i, tab.tabLabel) + )) } @@ -197,7 +195,7 @@ class EmojiPicker extends Component { } const mapStateToProps = (state: any) => ({ - customEmojis: state.customEmojis + customEmojis: state.customEmojis, }); export default connect(mapStateToProps)(withTheme(EmojiPicker)); diff --git a/app/containers/EmojiPicker/interfaces.ts b/app/containers/EmojiPicker/interfaces.ts index 0d88c78a5..ff21e9546 100644 --- a/app/containers/EmojiPicker/interfaces.ts +++ b/app/containers/EmojiPicker/interfaces.ts @@ -1,22 +1,22 @@ export interface IEmoji { - content: any; - name: string; - extension: any; - isCustom: boolean; + content: any; + name: string; + extension: any; + isCustom: boolean; } export interface ICustomEmoji { - baseUrl: string, - emoji: IEmoji, - style: any + baseUrl: string, + emoji: IEmoji, + style: any } export interface IEmojiCategory { - baseUrl: string; - emojis: IEmoji[]; - onEmojiSelected({}: any): void; - emojisPerRow: number; - width: number; - style: any; - tabLabel: string; + baseUrl: string; + emojis: IEmoji[]; + onEmojiSelected: Function; + emojisPerRow: number; + width: number; + style: any; + tabLabel: string; } diff --git a/app/containers/EmojiPicker/styles.ts b/app/containers/EmojiPicker/styles.ts index ca1263275..b3a35a97a 100644 --- a/app/containers/EmojiPicker/styles.ts +++ b/app/containers/EmojiPicker/styles.ts @@ -4,29 +4,29 @@ import sharedStyles from '../../views/Styles'; export default StyleSheet.create({ container: { - flex: 1 + flex: 1, }, tabsContainer: { height: 45, flexDirection: 'row', - paddingTop: 5 + paddingTop: 5, }, tab: { flex: 1, alignItems: 'center', justifyContent: 'center', - paddingBottom: 10 + paddingBottom: 10, }, tabEmoji: { fontSize: 20, - color: 'black' + color: 'black', }, activeTabLine: { position: 'absolute', left: 0, right: 0, height: 2, - bottom: 0 + bottom: 0, }, tabLine: { position: 'absolute', @@ -34,25 +34,25 @@ export default StyleSheet.create({ right: 0, height: 2, backgroundColor: 'rgba(0,0,0,0.05)', - bottom: 0 + bottom: 0, }, categoryContainer: { flex: 1, - alignItems: 'flex-start' + alignItems: 'flex-start', }, categoryInner: { flexWrap: 'wrap', flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', - flex: 1 + flex: 1, }, categoryEmoji: { ...sharedStyles.textAlignCenter, backgroundColor: 'transparent', - color: '#ffffff' + color: '#ffffff', }, customCategoryEmoji: { - margin: 8 - } + margin: 8, + }, }); diff --git a/app/containers/FormContainer.tsx b/app/containers/FormContainer.tsx index 5d3e683f2..49452419c 100644 --- a/app/containers/FormContainer.tsx +++ b/app/containers/FormContainer.tsx @@ -18,8 +18,8 @@ interface IFormContainer { const styles = StyleSheet.create({ scrollView: { - minHeight: '100%' - } + minHeight: '100%', + }, }); export const FormContainerInner = ({ children }: {children: JSX.Element}) => ( @@ -36,7 +36,7 @@ const FormContainer = ({ children, theme, testID, ...props }: IFormContainer) => keyboardVerticalOffset={128} > - {/*@ts-ignore*/} + {/* @ts-ignore*/} { if (isIOS) { if (isLandscape && !isTablet) { return 32; - } else { - return 44; } + return 44; } return 56; }; @@ -30,7 +30,7 @@ interface IHeaderTitlePosition { export const getHeaderTitlePosition = ({ insets, numIconsRight }: IHeaderTitlePosition) => ({ left: insets.left + 60, - right: insets.right + Math.max(45 * numIconsRight, 15) + right: insets.right + Math.max(45 * numIconsRight, 15), }); const styles = StyleSheet.create({ @@ -38,8 +38,8 @@ const styles = StyleSheet.create({ height: headerHeight, flexDirection: 'row', justifyContent: 'center', - elevation: 4 - } + elevation: 4, + }, }); interface IHeader { diff --git a/app/containers/HeaderButton/Common.tsx b/app/containers/HeaderButton/Common.tsx index 7d0ed587c..e00cb8a1a 100644 --- a/app/containers/HeaderButton/Common.tsx +++ b/app/containers/HeaderButton/Common.tsx @@ -18,7 +18,7 @@ export const Drawer = React.memo(({ navigation, testID, ...props }: Partial )); -export const CloseModal = React.memo(({navigation, testID, onPress = () => navigation.pop(), ...props}: IHeaderButtonCommon) => ( +export const CloseModal = React.memo(({ navigation, testID, onPress = () => navigation.pop(), ...props }: IHeaderButtonCommon) => ( diff --git a/app/containers/HeaderButton/HeaderButtonContainer.tsx b/app/containers/HeaderButton/HeaderButtonContainer.tsx index ce6506b67..55875cb33 100644 --- a/app/containers/HeaderButton/HeaderButtonContainer.tsx +++ b/app/containers/HeaderButton/HeaderButtonContainer.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, View } from 'react-native'; interface IHeaderButtonContainer { children: JSX.Element; @@ -10,14 +10,14 @@ const styles = StyleSheet.create({ container: { flexDirection: 'row', alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, left: { - marginLeft: 5 + marginLeft: 5, }, right: { - marginRight: 5 - } + marginRight: 5, + }, }); const Container = ({ children, left = false }: IHeaderButtonContainer) => ( diff --git a/app/containers/HeaderButton/HeaderButtonItem.tsx b/app/containers/HeaderButton/HeaderButtonItem.tsx index 5688953ff..1020db1b5 100644 --- a/app/containers/HeaderButton/HeaderButtonItem.tsx +++ b/app/containers/HeaderButton/HeaderButtonItem.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Text, StyleSheet, Platform } from 'react-native'; +import { Platform, StyleSheet, Text } from 'react-native'; import Touchable from 'react-native-platform-touchable'; import { CustomIcon } from '../../lib/Icons'; @@ -17,27 +17,27 @@ interface IHeaderButtonItem { } export const BUTTON_HIT_SLOP = { - top: 5, right: 5, bottom: 5, left: 5 + top: 5, right: 5, bottom: 5, left: 5, }; const styles = StyleSheet.create({ container: { - marginHorizontal: 6 + marginHorizontal: 6, }, title: { ...Platform.select({ android: { - fontSize: 14 + fontSize: 14, }, default: { - fontSize: 17 - } + fontSize: 17, + }, }), - ...sharedStyles.textRegular - } + ...sharedStyles.textRegular, + }, }); -const Item = ({title, iconName, onPress, testID, theme, badge}: IHeaderButtonItem) => ( +const Item = ({ title, iconName, onPress, testID, theme, badge }: IHeaderButtonItem) => ( <> { diff --git a/app/containers/HeaderButton/HeaderButtonItemBadge.tsx b/app/containers/HeaderButton/HeaderButtonItemBadge.tsx index 9a760b828..3f61a653f 100644 --- a/app/containers/HeaderButton/HeaderButtonItemBadge.tsx +++ b/app/containers/HeaderButton/HeaderButtonItemBadge.tsx @@ -11,8 +11,8 @@ const styles = StyleSheet.create({ top: -3, borderRadius: 10, alignItems: 'center', - justifyContent: 'center' - } + justifyContent: 'center', + }, }); export const Badge = ({ ...props }) => ( diff --git a/app/containers/InAppNotification/NotifierComponent.tsx b/app/containers/InAppNotification/NotifierComponent.tsx index c537ae1ce..b428cc495 100644 --- a/app/containers/InAppNotification/NotifierComponent.tsx +++ b/app/containers/InAppNotification/NotifierComponent.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { StyleSheet, View, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import Touchable from 'react-native-platform-touchable'; import { connect } from 'react-redux'; import { Notifier } from 'react-native-notifier'; @@ -32,36 +32,36 @@ const styles = StyleSheet.create({ justifyContent: 'space-between', marginHorizontal: 10, borderWidth: StyleSheet.hairlineWidth, - borderRadius: 4 + borderRadius: 4, }, content: { flex: 1, flexDirection: 'row', - alignItems: 'center' + alignItems: 'center', }, inner: { - flex: 1 + flex: 1, }, avatar: { - marginRight: 10 + marginRight: 10, }, roomName: { fontSize: 17, lineHeight: 20, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, message: { fontSize: 14, lineHeight: 17, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, close: { - marginLeft: 10 + marginLeft: 10, }, small: { width: '50%', - alignSelf: 'center' - } + alignSelf: 'center', + }, }); const hideNotification = () => Notifier.hideNotification(); @@ -83,7 +83,7 @@ const NotifierComponent = React.memo(({ notification, isMasterDetail }: INotifie return; } const item = { - rid, name: title, t: type, prid + rid, name: title, t: type, prid, }; if (isMasterDetail) { @@ -102,8 +102,8 @@ const NotifierComponent = React.memo(({ notification, isMasterDetail }: INotifie { backgroundColor: themes[theme].focusedBackground, borderColor: themes[theme].separatorColor, - marginTop: insets.top - } + marginTop: insets.top, + }, ]} > ({ - isMasterDetail: state.app.isMasterDetail + isMasterDetail: state.app.isMasterDetail, }); export default connect(mapStateToProps)(NotifierComponent); diff --git a/app/containers/InAppNotification/index.tsx b/app/containers/InAppNotification/index.tsx index d00f80879..ba75c5850 100644 --- a/app/containers/InAppNotification/index.tsx +++ b/app/containers/InAppNotification/index.tsx @@ -1,5 +1,5 @@ import React, { memo, useEffect } from 'react'; -import { NotifierRoot, Notifier, Easing } from 'react-native-notifier'; +import { Easing, Notifier, NotifierRoot } from 'react-native-notifier'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; @@ -27,8 +27,8 @@ const InAppNotification = memo(({ rooms, appState }: {rooms: any, appState: stri showEasing: Easing.inOut(Easing.quad), Component: NotifierComponent, componentProps: { - notification - } + notification, + }, }); } }; @@ -45,7 +45,7 @@ const InAppNotification = memo(({ rooms, appState }: {rooms: any, appState: stri const mapStateToProps = (state: any) => ({ rooms: state.room.rooms, - appState: state.app.ready && state.app.foreground ? 'foreground' : 'background' + appState: state.app.ready && state.app.foreground ? 'foreground' : 'background', }); export default connect(mapStateToProps)(InAppNotification); diff --git a/app/containers/List/ListContainer.tsx b/app/containers/List/ListContainer.tsx index b8a6f77d6..ea55d6cf2 100644 --- a/app/containers/List/ListContainer.tsx +++ b/app/containers/List/ListContainer.tsx @@ -1,12 +1,13 @@ import React from 'react'; import { ScrollView, StyleSheet } from 'react-native'; + import { withTheme } from '../../theme'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; const styles = StyleSheet.create({ container: { - paddingVertical: 16 - } + paddingVertical: 16, + }, }); interface IListContainer { diff --git a/app/containers/List/ListHeader.tsx b/app/containers/List/ListHeader.tsx index 54d8b009b..775ec4771 100644 --- a/app/containers/List/ListHeader.tsx +++ b/app/containers/List/ListHeader.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import sharedStyles from '../../views/Styles'; import { themes } from '../../constants/colors'; @@ -10,12 +10,12 @@ import { PADDING_HORIZONTAL } from './constants'; const styles = StyleSheet.create({ container: { paddingBottom: 12, - paddingHorizontal: PADDING_HORIZONTAL + paddingHorizontal: PADDING_HORIZONTAL, }, title: { fontSize: 16, - ...sharedStyles.textRegular - } + ...sharedStyles.textRegular, + }, }); interface IListHeader { diff --git a/app/containers/List/ListIcon.tsx b/app/containers/List/ListIcon.tsx index 2fc41e850..137343dc6 100644 --- a/app/containers/List/ListIcon.tsx +++ b/app/containers/List/ListIcon.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, View } from 'react-native'; import { themes } from '../../constants/colors'; import { CustomIcon } from '../../lib/Icons'; @@ -17,8 +17,8 @@ interface IListIcon { const styles = StyleSheet.create({ icon: { alignItems: 'center', - justifyContent: 'center' - } + justifyContent: 'center', + }, }); const ListIcon = React.memo(({ theme, name, color, style, testID }: IListIcon) => ( diff --git a/app/containers/List/ListInfo.tsx b/app/containers/List/ListInfo.tsx index 5f75258e0..14d75cb59 100644 --- a/app/containers/List/ListInfo.tsx +++ b/app/containers/List/ListInfo.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import sharedStyles from '../../views/Styles'; import { themes } from '../../constants/colors'; @@ -10,12 +10,12 @@ import I18n from '../../i18n'; const styles = StyleSheet.create({ container: { paddingTop: 8, - paddingHorizontal: PADDING_HORIZONTAL + paddingHorizontal: PADDING_HORIZONTAL, }, text: { fontSize: 14, - ...sharedStyles.textRegular - } + ...sharedStyles.textRegular, + }, }); interface IListHeader { diff --git a/app/containers/List/ListItem.tsx b/app/containers/List/ListItem.tsx index fa943da0d..2840902d9 100644 --- a/app/containers/List/ListItem.tsx +++ b/app/containers/List/ListItem.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text, StyleSheet, I18nManager } from 'react-native'; +import { I18nManager, StyleSheet, Text, View } from 'react-native'; import Touch from '../../utils/touch'; import { themes } from '../../constants/colors'; @@ -17,42 +17,42 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', - paddingHorizontal: PADDING_HORIZONTAL + paddingHorizontal: PADDING_HORIZONTAL, }, leftContainer: { - paddingRight: PADDING_HORIZONTAL + paddingRight: PADDING_HORIZONTAL, }, rightContainer: { - paddingLeft: PADDING_HORIZONTAL + paddingLeft: PADDING_HORIZONTAL, }, disabled: { - opacity: 0.3 + opacity: 0.3, }, textContainer: { flex: 1, - justifyContent: 'center' + justifyContent: 'center', }, textAlertContainer: { flexDirection: 'row', - alignItems: 'center' + alignItems: 'center', }, alertIcon: { - paddingLeft: 4 + paddingLeft: 4, }, title: { flexShrink: 1, fontSize: 16, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, subtitle: { fontSize: 14, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, actionIndicator: { ...I18nManager.isRTL ? { transform: [{ rotate: '180deg' }] } - : {} - } + : {}, + }, }); interface IListItemContent { @@ -72,7 +72,7 @@ interface IListItemContent { } const Content = React.memo(({ - title, subtitle, disabled, testID, left, right, color, theme, fontScale, alert, translateTitle = true, translateSubtitle = true, showActionIndicator = false + title, subtitle, disabled, testID, left, right, color, theme, fontScale, alert, translateTitle = true, translateSubtitle = true, showActionIndicator = false, }: IListItemContent) => ( {left diff --git a/app/containers/List/ListSection.tsx b/app/containers/List/ListSection.tsx index 105ac5d1b..0acd2a78f 100644 --- a/app/containers/List/ListSection.tsx +++ b/app/containers/List/ListSection.tsx @@ -1,12 +1,13 @@ import React from 'react'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, View } from 'react-native'; + import { withTheme } from '../../theme'; import { Header } from '.'; const styles = StyleSheet.create({ container: { - marginVertical: 16 - } + marginVertical: 16, + }, }); interface IListSection { diff --git a/app/containers/List/ListSeparator.tsx b/app/containers/List/ListSeparator.tsx index a7de16349..94c7e3f55 100644 --- a/app/containers/List/ListSeparator.tsx +++ b/app/containers/List/ListSeparator.tsx @@ -1,13 +1,13 @@ import React from 'react'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, View } from 'react-native'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; const styles = StyleSheet.create({ separator: { - height: StyleSheet.hairlineWidth - } + height: StyleSheet.hairlineWidth, + }, }); interface IListSeparator { @@ -20,7 +20,7 @@ const ListSeparator = React.memo(({ style, theme }: IListSeparator) => ( style={[ styles.separator, style, - { backgroundColor: themes[theme].separatorColor } + { backgroundColor: themes[theme].separatorColor }, ]} /> )); diff --git a/app/containers/List/styles.ts b/app/containers/List/styles.ts index 2c0904284..c7e316f8b 100644 --- a/app/containers/List/styles.ts +++ b/app/containers/List/styles.ts @@ -2,6 +2,6 @@ import { StyleSheet } from 'react-native'; export const styles = StyleSheet.create({ contentContainerStyleFlatList: { - paddingVertical: 32 - } + paddingVertical: 32, + }, }); diff --git a/app/containers/Loading.tsx b/app/containers/Loading.tsx index 03e0ca9f5..f963112b6 100644 --- a/app/containers/Loading.tsx +++ b/app/containers/Loading.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { StyleSheet, Modal, Animated , View } from 'react-native'; +import { Animated, Modal, StyleSheet, View } from 'react-native'; + import { withTheme } from '../theme'; import { themes } from '../constants/colors'; @@ -7,13 +8,13 @@ const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, image: { width: 100, height: 100, - resizeMode: 'contain' - } + resizeMode: 'contain', + }, }); interface ILoadingProps { @@ -22,12 +23,13 @@ interface ILoadingProps { } class Loading extends React.PureComponent { - state = { scale: new Animated.Value(1), - opacity: new Animated.Value(0) + opacity: new Animated.Value(0), } + private opacityAnimation: any; + private scaleAnimation: any; componentDidMount() { @@ -39,8 +41,8 @@ class Loading extends React.PureComponent { { toValue: 1, duration: 200, - useNativeDriver: true - } + useNativeDriver: true, + }, ); this.scaleAnimation = Animated.loop(Animated.sequence([ Animated.timing( @@ -48,17 +50,17 @@ class Loading extends React.PureComponent { { toValue: 0, duration: 1000, - useNativeDriver: true - } + useNativeDriver: true, + }, ), Animated.timing( scale, { toValue: 1, duration: 1000, - useNativeDriver: true - } - ) + useNativeDriver: true, + }, + ), ])); if (visible) { @@ -97,13 +99,13 @@ class Loading extends React.PureComponent { const scaleAnimation = scale.interpolate({ inputRange: [0, 0.5, 1], - outputRange: [1, 1.1, 1] + outputRange: [1, 1.1, 1], }); const opacityAnimation = opacity.interpolate({ inputRange: [0, 1], outputRange: [0, themes[theme].backdropOpacity], - extrapolate: 'clamp' + extrapolate: 'clamp', }); return ( @@ -121,15 +123,15 @@ class Loading extends React.PureComponent { // @ts-ignore ...StyleSheet.absoluteFill, backgroundColor: themes[theme].backdropColor, - opacity: opacityAnimation + opacity: opacityAnimation, }]} /> @@ -138,4 +140,4 @@ class Loading extends React.PureComponent { } } -export default (withTheme(Loading)); +export default withTheme(Loading); diff --git a/app/containers/LoginServices.tsx b/app/containers/LoginServices.tsx index e9dd930e9..732284821 100644 --- a/app/containers/LoginServices.tsx +++ b/app/containers/LoginServices.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text, Animated, Easing, Linking } from 'react-native'; +import { Animated, Easing, Linking, StyleSheet, Text, View } from 'react-native'; import { connect } from 'react-redux'; import { Base64 } from 'js-base64'; import * as AppleAuthentication from 'expo-apple-authentication'; @@ -12,7 +12,7 @@ import OrSeparator from './OrSeparator'; import Touch from '../utils/touch'; import I18n from '../i18n'; import random from '../utils/random'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; import RocketChat from '../lib/rocketchat'; import { CustomIcon } from '../lib/Icons'; @@ -27,7 +27,7 @@ const LOGIN_STYPE_REDIRECT = 'redirect'; const styles = StyleSheet.create({ serviceButton: { borderRadius: BORDER_RADIUS, - marginBottom: 10 + marginBottom: 10, }, serviceButtonContainer: { borderRadius: BORDER_RADIUS, @@ -36,25 +36,25 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', - paddingHorizontal: 15 + paddingHorizontal: 15, }, serviceIcon: { position: 'absolute', left: 15, top: 12, width: 24, - height: 24 + height: 24, }, serviceText: { ...sharedStyles.textRegular, - fontSize: 16 + fontSize: 16, }, serviceName: { - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, options: { - marginBottom: 0 - } + marginBottom: 0, + }, }); interface IOpenOAuth { @@ -94,12 +94,12 @@ class LoginServices extends React.PureComponent { private _animation: any; static defaultProps = { - separator: true + separator: true, } state = { collapsed: true, - servicesHeight: new Animated.Value(SERVICES_COLLAPSED_HEIGHT) + servicesHeight: new Animated.Value(SERVICES_COLLAPSED_HEIGHT), } onPressFacebook = () => { @@ -198,7 +198,7 @@ class LoginServices extends React.PureComponent { logEvent(events.ENTER_WITH_CUSTOM_OAUTH); const { server } = this.props; const { - serverURL, authorizePath, clientId, scope, service + serverURL, authorizePath, clientId, scope, service, } = loginService; const redirectUri = `${ server }/_oauth/${ service }`; const state = this.getOAuthState(); @@ -227,14 +227,14 @@ class LoginServices extends React.PureComponent { this.openOAuth({ url, ssoToken, authType: 'cas' }); } - onPressAppleLogin = async() => { + onPressAppleLogin = async () => { logEvent(events.ENTER_WITH_APPLE); try { const { fullName, email, identityToken } = await AppleAuthentication.signInAsync({ requestedScopes: [ AppleAuthentication.AppleAuthenticationScope.FULL_NAME, - AppleAuthentication.AppleAuthenticationScope.EMAIL - ] + AppleAuthentication.AppleAuthenticationScope.EMAIL, + ], }); await RocketChat.loginOAuthOrSso({ fullName, email, identityToken }); @@ -249,7 +249,7 @@ class LoginServices extends React.PureComponent { if (loginStyle === LOGIN_STYPE_REDIRECT) { obj = { ...obj, - redirectUrl: 'rocketchat://auth' + redirectUrl: 'rocketchat://auth', }; } return Base64.encodeURI(JSON.stringify(obj)); @@ -270,7 +270,7 @@ class LoginServices extends React.PureComponent { toValue: height, duration: 300, // @ts-ignore - easing: Easing.easeOutCubic + easing: Easing.easeOutCubic, }).start(); } @@ -295,7 +295,7 @@ class LoginServices extends React.PureComponent { linkedin: this.onPressLinkedin, 'meteor-developer': this.onPressMeteor, twitter: this.onPressTwitter, - wordpress: this.onPressWordpress + wordpress: this.onPressWordpress, }; return oauthProviders[name]; } @@ -396,7 +396,7 @@ class LoginServices extends React.PureComponent { const { length } = Object.values(services); const style = { overflow: 'hidden', - height: servicesHeight + height: servicesHeight, }; if (length > 3 && separator) { @@ -423,7 +423,7 @@ const mapStateToProps = (state: any) => ({ Gitlab_URL: state.settings.API_Gitlab_URL, CAS_enabled: state.settings.CAS_enabled, CAS_login_url: state.settings.CAS_login_url, - services: state.login.services + services: state.login.services, }); export default connect(mapStateToProps)(withTheme(LoginServices)); diff --git a/app/containers/MessageActions/Header.tsx b/app/containers/MessageActions/Header.tsx index 53dbab8a9..b89cec13d 100644 --- a/app/containers/MessageActions/Header.tsx +++ b/app/containers/MessageActions/Header.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useState, useCallback } from 'react'; -import { View, Text, FlatList, StyleSheet } from 'react-native'; +import React, { useCallback, useEffect, useState } from 'react'; +import { FlatList, StyleSheet, Text, View } from 'react-native'; import { withTheme } from '../../theme'; import { themes } from '../../constants/colors'; @@ -10,7 +10,7 @@ import database from '../../lib/database'; import { Button } from '../ActionSheet'; import { useDimensions } from '../../dimensions'; import sharedStyles from '../../views/Styles'; -import {IEmoji} from "../EmojiPicker/interfaces"; +import { IEmoji } from '../EmojiPicker/interfaces'; interface IHeader { handleReaction: Function; @@ -40,7 +40,7 @@ const ITEM_MARGIN = 8; const styles = StyleSheet.create({ container: { alignItems: 'center', - marginHorizontal: CONTAINER_MARGIN + marginHorizontal: CONTAINER_MARGIN, }, headerItem: { height: ITEM_SIZE, @@ -48,17 +48,17 @@ const styles = StyleSheet.create({ borderRadius: ITEM_SIZE / 2, marginHorizontal: ITEM_MARGIN, justifyContent: 'center', - alignItems: 'center' + alignItems: 'center', }, headerIcon: { ...sharedStyles.textAlignCenter, fontSize: 20, - color: '#fff' + color: '#fff', }, customEmoji: { height: 20, - width: 20 - } + width: 20, + }, }); const keyExtractor = (item: any) => item?.id || item; @@ -97,7 +97,7 @@ const Header = React.memo(({ handleReaction, server, message, isMasterDetail, th const [items, setItems] = useState([]); const { width, height }: any = useDimensions(); - const setEmojis = async() => { + const setEmojis = async () => { try { const db = database.active; const freqEmojiCollection = db.get('frequently_used_emojis'); diff --git a/app/containers/MessageActions/index.tsx b/app/containers/MessageActions/index.tsx index 96a4982b8..8fc6740d2 100644 --- a/app/containers/MessageActions/index.tsx +++ b/app/containers/MessageActions/index.tsx @@ -68,12 +68,12 @@ const MessageActions = React.memo(forwardRef(({ editMessagePermission, deleteMessagePermission, forceDeleteMessagePermission, - pinMessagePermission + pinMessagePermission, }: IMessageActions, ref): any => { let permissions: any = {}; const { showActionSheet, hideActionSheet }: any = useActionSheet(); - const getPermissions = async() => { + const getPermissions = async () => { try { const permission = [editMessagePermission, deleteMessagePermission, forceDeleteMessagePermission, pinMessagePermission]; const result = await RocketChat.hasPermission(permission, room.rid); @@ -81,7 +81,7 @@ const MessageActions = React.memo(forwardRef(({ hasEditPermission: result[0], hasDeletePermission: result[1], hasForceDeletePermission: result[2], - hasPinPermission: result[3] + hasPinPermission: result[3], }; } catch { // Do nothing @@ -167,7 +167,7 @@ const MessageActions = React.memo(forwardRef(({ } }; - const handleUnread = async(message: any) => { + const handleUnread = async (message: any) => { logEvent(events.ROOM_MSG_ACTION_UNREAD); const { id: messageId, ts } = message; const { rid } = room; @@ -177,7 +177,7 @@ const MessageActions = React.memo(forwardRef(({ if (result.success) { const subCollection = db.get('subscriptions'); const subRecord = await subCollection.find(rid); - await db.action(async() => { + await db.action(async () => { try { await subRecord.update((sub: any) => sub.lastOpen = ts); } catch { @@ -192,7 +192,7 @@ const MessageActions = React.memo(forwardRef(({ } }; - const handlePermalink = async(message: any) => { + const handlePermalink = async (message: any) => { logEvent(events.ROOM_MSG_ACTION_PERMALINK); try { const permalink: any = await getPermalink(message); @@ -203,13 +203,13 @@ const MessageActions = React.memo(forwardRef(({ } }; - const handleCopy = async(message: any) => { + const handleCopy = async (message: any) => { logEvent(events.ROOM_MSG_ACTION_COPY); await Clipboard.setString(message?.attachments?.[0]?.description || message.msg); EventEmitter.emit(LISTENER, { message: I18n.t('Copied_to_clipboard') }); }; - const handleShare = async(message: any) => { + const handleShare = async (message: any) => { logEvent(events.ROOM_MSG_ACTION_SHARE); try { const permalink: any = await getPermalink(message); @@ -224,7 +224,7 @@ const MessageActions = React.memo(forwardRef(({ replyInit(message, false); }; - const handleStar = async(message: any) => { + const handleStar = async (message: any) => { logEvent(message.starred ? events.ROOM_MSG_ACTION_UNSTAR : events.ROOM_MSG_ACTION_STAR); try { await RocketChat.toggleStarMessage(message.id, message.starred); @@ -235,7 +235,7 @@ const MessageActions = React.memo(forwardRef(({ } }; - const handlePin = async(message: any) => { + const handlePin = async (message: any) => { logEvent(events.ROOM_MSG_ACTION_PIN); try { await RocketChat.togglePinMessage(message.id, message.pinned); @@ -264,10 +264,10 @@ const MessageActions = React.memo(forwardRef(({ } }; - const handleToggleTranslation = async(message: any) => { + const handleToggleTranslation = async (message: any) => { try { const db = database.active; - await db.action(async() => { + await db.action(async () => { await message.update((m: any) => { m.autoTranslate = !m.autoTranslate; m._updatedAt = new Date(); @@ -279,7 +279,7 @@ const MessageActions = React.memo(forwardRef(({ _id: message.id, rid: message.subscription.id, u: message.u, - msg: message.msg + msg: message.msg, }; await RocketChat.translateMessage(m, room.autoTranslateLanguage); } @@ -288,7 +288,7 @@ const MessageActions = React.memo(forwardRef(({ } }; - const handleReport = async(message: any) => { + const handleReport = async (message: any) => { logEvent(events.ROOM_MSG_ACTION_REPORT); try { await RocketChat.reportMessage(message.id); @@ -305,7 +305,7 @@ const MessageActions = React.memo(forwardRef(({ showConfirmationAlert({ message: I18n.t('You_will_not_be_able_to_recover_this_message'), confirmationText: I18n.t('Delete'), - onPress: async() => { + onPress: async () => { try { logEvent(events.ROOM_MSG_ACTION_DELETE); await RocketChat.deleteMessage(message.id, message.subscription.id); @@ -313,7 +313,7 @@ const MessageActions = React.memo(forwardRef(({ logEvent(events.ROOM_MSG_ACTION_DELETE_F); log(e); } - } + }, }); }; @@ -325,7 +325,7 @@ const MessageActions = React.memo(forwardRef(({ options = [{ title: I18n.t('Reply_in_Thread'), icon: 'threads', - onPress: () => handleReply(message) + onPress: () => handleReply(message), }]; } @@ -334,7 +334,7 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t('Quote'), icon: 'quote', - onPress: () => handleQuote(message) + onPress: () => handleQuote(message), }); } @@ -343,7 +343,7 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t('Edit'), icon: 'edit', - onPress: () => handleEdit(message) + onPress: () => handleEdit(message), }); } @@ -351,14 +351,14 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t('Permalink'), icon: 'link', - onPress: () => handlePermalink(message) + onPress: () => handlePermalink(message), }); // Create Discussion options.push({ title: I18n.t('Start_a_Discussion'), icon: 'discussions', - onPress: () => handleCreateDiscussion(message) + onPress: () => handleCreateDiscussion(message), }); // Mark as unread @@ -366,7 +366,7 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t('Mark_unread'), icon: 'flag', - onPress: () => handleUnread(message) + onPress: () => handleUnread(message), }); } @@ -374,14 +374,14 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t('Copy'), icon: 'copy', - onPress: () => handleCopy(message) + onPress: () => handleCopy(message), }); // Share options.push({ title: I18n.t('Share'), icon: 'share', - onPress: () => handleShare(message) + onPress: () => handleShare(message), }); // Star @@ -389,7 +389,7 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t(message.starred ? 'Unstar' : 'Star'), icon: message.starred ? 'star-filled' : 'star', - onPress: () => handleStar(message) + onPress: () => handleStar(message), }); } @@ -398,7 +398,7 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t(message.pinned ? 'Unpin' : 'Pin'), icon: 'pin', - onPress: () => handlePin(message) + onPress: () => handlePin(message), }); } @@ -407,7 +407,7 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t('Read_Receipt'), icon: 'info', - onPress: () => handleReadReceipt(message) + onPress: () => handleReadReceipt(message), }); } @@ -416,7 +416,7 @@ const MessageActions = React.memo(forwardRef(({ options.push({ title: I18n.t(message.autoTranslate ? 'View_Original' : 'Translate'), icon: 'language', - onPress: () => handleToggleTranslation(message) + onPress: () => handleToggleTranslation(message), }); } @@ -425,7 +425,7 @@ const MessageActions = React.memo(forwardRef(({ title: I18n.t('Report'), icon: 'warning', danger: true, - onPress: () => handleReport(message) + onPress: () => handleReport(message), }); // Delete @@ -434,27 +434,27 @@ const MessageActions = React.memo(forwardRef(({ title: I18n.t('Delete'), icon: 'delete', danger: true, - onPress: () => handleDelete(message) + onPress: () => handleDelete(message), }); } return options; }; - const showMessageActions = async(message: any) => { + const showMessageActions = async (message: any) => { logEvent(events.ROOM_SHOW_MSG_ACTIONS); await getPermissions(); showActionSheet({ options: getOptions(message), headerHeight: HEADER_HEIGHT, - customHeader: (!isReadOnly || room.reactWhenReadOnly ? ( + customHeader: !isReadOnly || room.reactWhenReadOnly ? (
- ) : null) + ) : null, }); }; @@ -476,7 +476,7 @@ const mapStateToProps = (state: any) => ({ editMessagePermission: state.permissions['edit-message'], deleteMessagePermission: state.permissions['delete-message'], forceDeleteMessagePermission: state.permissions['force-delete-message'], - pinMessagePermission: state.permissions['pin-message'] + pinMessagePermission: state.permissions['pin-message'], }); export default connect(mapStateToProps, null, null, { forwardRef: true })(MessageActions); diff --git a/app/containers/MessageBox/LeftButtons.android.tsx b/app/containers/MessageBox/LeftButtons.android.tsx index cf6934b77..73959949f 100644 --- a/app/containers/MessageBox/LeftButtons.android.tsx +++ b/app/containers/MessageBox/LeftButtons.android.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { CancelEditingButton, ToggleEmojiButton } from './buttons'; interface IMessageBoxLeftButtons { @@ -11,7 +12,7 @@ interface IMessageBoxLeftButtons { } const LeftButtons = React.memo(({ - theme, showEmojiKeyboard, editing, editCancel, openEmoji, closeEmoji + theme, showEmojiKeyboard, editing, editCancel, openEmoji, closeEmoji, }: IMessageBoxLeftButtons) => { if (editing) { return ; diff --git a/app/containers/MessageBox/LeftButtons.ios.tsx b/app/containers/MessageBox/LeftButtons.ios.tsx index 2064a909b..e24dbbd00 100644 --- a/app/containers/MessageBox/LeftButtons.ios.tsx +++ b/app/containers/MessageBox/LeftButtons.ios.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { View } from 'react-native'; -import { CancelEditingButton, ActionsButton } from './buttons'; +import { ActionsButton, CancelEditingButton } from './buttons'; import styles from './styles'; interface IMessageBoxLeftButtons { @@ -13,7 +13,7 @@ interface IMessageBoxLeftButtons { } const LeftButtons = React.memo(({ - theme, showMessageBoxActions, editing, editCancel, isActionsEnabled + theme, showMessageBoxActions, editing, editCancel, isActionsEnabled, }: IMessageBoxLeftButtons) => { if (editing) { return ; diff --git a/app/containers/MessageBox/Mentions/FixedMentionItem.tsx b/app/containers/MessageBox/Mentions/FixedMentionItem.tsx index 1aef1c6b0..75fbded28 100644 --- a/app/containers/MessageBox/Mentions/FixedMentionItem.tsx +++ b/app/containers/MessageBox/Mentions/FixedMentionItem.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { TouchableOpacity, Text } from 'react-native'; +import { Text, TouchableOpacity } from 'react-native'; import styles from '../styles'; import I18n from '../../../i18n'; @@ -9,7 +9,7 @@ interface IMessageBoxFixedMentionItem { item: { username: string; }; - onPress({}): void; + onPress: Function; theme: string; } @@ -19,8 +19,8 @@ const FixedMentionItem = ({ item, onPress, theme }: IMessageBoxFixedMentionItem) styles.mentionItem, { backgroundColor: themes[theme].auxiliaryBackground, - borderTopColor: themes[theme].separatorColor - } + borderTopColor: themes[theme].separatorColor, + }, ]} onPress={() => onPress(item)} > diff --git a/app/containers/MessageBox/Mentions/MentionEmoji.tsx b/app/containers/MessageBox/Mentions/MentionEmoji.tsx index cb60f634b..34833888a 100644 --- a/app/containers/MessageBox/Mentions/MentionEmoji.tsx +++ b/app/containers/MessageBox/Mentions/MentionEmoji.tsx @@ -6,7 +6,7 @@ import shortnameToUnicode from '../../../utils/shortnameToUnicode'; import styles from '../styles'; import MessageboxContext from '../Context'; import CustomEmoji from '../../EmojiPicker/CustomEmoji'; -import {IEmoji} from "../../EmojiPicker/interfaces"; +import { IEmoji } from '../../EmojiPicker/interfaces'; interface IMessageBoxMentionEmoji { item: IEmoji; @@ -33,7 +33,7 @@ const MentionEmoji = ({ item }: IMessageBoxMentionEmoji) => { }; MentionEmoji.propTypes = { - item: PropTypes.object + item: PropTypes.object, }; export default MentionEmoji; diff --git a/app/containers/MessageBox/Mentions/MentionItem.tsx b/app/containers/MessageBox/Mentions/MentionItem.tsx index b7c7f650f..4be3067eb 100644 --- a/app/containers/MessageBox/Mentions/MentionItem.tsx +++ b/app/containers/MessageBox/Mentions/MentionItem.tsx @@ -1,14 +1,14 @@ import React, { useContext } from 'react'; -import { TouchableOpacity, Text } from 'react-native'; +import { Text, TouchableOpacity } from 'react-native'; import styles from '../styles'; import Avatar from '../../Avatar'; import MessageboxContext from '../Context'; import FixedMentionItem from './FixedMentionItem'; import MentionEmoji from './MentionEmoji'; -import { MENTIONS_TRACKING_TYPE_EMOJIS, MENTIONS_TRACKING_TYPE_COMMANDS } from '../constants'; +import { MENTIONS_TRACKING_TYPE_COMMANDS, MENTIONS_TRACKING_TYPE_EMOJIS } from '../constants'; import { themes } from '../../../constants/colors'; -import {IEmoji} from "../../EmojiPicker/interfaces"; +import { IEmoji } from '../../EmojiPicker/interfaces'; interface IMessageBoxMentionItem { item: { @@ -79,8 +79,8 @@ const MentionItem = ({ item, trackingType, theme }: IMessageBoxMentionItem) => { styles.mentionItem, { backgroundColor: themes[theme].auxiliaryBackground, - borderTopColor: themes[theme].separatorColor - } + borderTopColor: themes[theme].separatorColor, + }, ]} onPress={() => onPressMention(item)} testID={testID} diff --git a/app/containers/MessageBox/RecordAudio.tsx b/app/containers/MessageBox/RecordAudio.tsx index 56a5a2b9a..3e46b466d 100644 --- a/app/containers/MessageBox/RecordAudio.tsx +++ b/app/containers/MessageBox/RecordAudio.tsx @@ -1,20 +1,20 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import { Audio } from 'expo-av'; import { BorderlessButton } from 'react-native-gesture-handler'; import { getInfoAsync } from 'expo-file-system'; -import { deactivateKeepAwake, activateKeepAwake } from 'expo-keep-awake'; +import { activateKeepAwake, deactivateKeepAwake } from 'expo-keep-awake'; import styles from './styles'; import I18n from '../../i18n'; import { themes } from '../../constants/colors'; import { CustomIcon } from '../../lib/Icons'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; interface IMessageBoxRecordAudioProps { theme: string; - recordingCallback({}): void; - onFinish({}): void; + recordingCallback: Function; + onFinish: Function; } const RECORDING_EXTENSION = '.aac'; @@ -25,7 +25,7 @@ const RECORDING_SETTINGS = { audioEncoder: Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC, sampleRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.android.sampleRate, numberOfChannels: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.android.numberOfChannels, - bitRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.android.bitRate + bitRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.android.bitRate, }, ios: { extension: RECORDING_EXTENSION, @@ -33,8 +33,8 @@ const RECORDING_SETTINGS = { sampleRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.ios.sampleRate, numberOfChannels: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.ios.numberOfChannels, bitRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.ios.bitRate, - outputFormat: Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC - } + outputFormat: Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC, + }, }; const RECORDING_MODE = { allowsRecordingIOS: true, @@ -43,7 +43,7 @@ const RECORDING_MODE = { shouldDuckAndroid: true, playThroughEarpieceAndroid: false, interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, - interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX + interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, }; const formatTime = function(seconds: any) { @@ -56,6 +56,7 @@ const formatTime = function(seconds: any) { export default class RecordAudio extends React.PureComponent { private isRecorderBusy: boolean; + private recording: any; constructor(props: IMessageBoxRecordAudioProps) { @@ -63,7 +64,7 @@ export default class RecordAudio extends React.PureComponent { + isRecordingPermissionGranted = async () => { try { const permission = await Audio.getPermissionsAsync(); if (permission.status === 'granted') { @@ -101,11 +102,11 @@ export default class RecordAudio extends React.PureComponent { this.setState({ isRecording: status.isRecording, - recordingDurationMillis: status.durationMillis + recordingDurationMillis: status.durationMillis, }); } - startRecordingAudio = async() => { + startRecordingAudio = async () => { logEvent(events.ROOM_AUDIO_RECORD); if (!this.isRecorderBusy) { this.isRecorderBusy = true; @@ -130,7 +131,7 @@ export default class RecordAudio extends React.PureComponent { + finishRecordingAudio = async () => { logEvent(events.ROOM_AUDIO_FINISH); if (!this.isRecorderBusy) { const { onFinish } = this.props; @@ -147,7 +148,7 @@ export default class RecordAudio extends React.PureComponent { + cancelRecordingAudio = async () => { logEvent(events.ROOM_AUDIO_CANCEL); if (!this.isRecorderBusy) { this.isRecorderBusy = true; diff --git a/app/containers/MessageBox/ReplyPreview.tsx b/app/containers/MessageBox/ReplyPreview.tsx index 6d0b8db51..6118f0233 100644 --- a/app/containers/MessageBox/ReplyPreview.tsx +++ b/app/containers/MessageBox/ReplyPreview.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import moment from 'moment'; import { connect } from 'react-redux'; @@ -11,33 +11,33 @@ import { themes } from '../../constants/colors'; const styles = StyleSheet.create({ container: { flexDirection: 'row', - paddingTop: 10 + paddingTop: 10, }, messageContainer: { flex: 1, marginHorizontal: 10, paddingHorizontal: 15, paddingVertical: 10, - borderRadius: 4 + borderRadius: 4, }, header: { flexDirection: 'row', - alignItems: 'center' + alignItems: 'center', }, username: { fontSize: 16, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, time: { fontSize: 12, lineHeight: 16, marginLeft: 6, ...sharedStyles.textRegular, - fontWeight: '300' + fontWeight: '300', }, close: { - marginRight: 10 - } + marginRight: 10, + }, }); interface IMessageBoxReplyPreview { @@ -51,13 +51,13 @@ interface IMessageBoxReplyPreview { close(): void; baseUrl: string; username: string; - getCustomEmoji(): void; + getCustomEmoji: Function; theme: string; useRealName: boolean; } const ReplyPreview = React.memo(({ - message, Message_TimeFormat, baseUrl, username, replying, getCustomEmoji, close, theme, useRealName + message, Message_TimeFormat, baseUrl, username, replying, getCustomEmoji, close, theme, useRealName, }: IMessageBoxReplyPreview) => { if (!replying) { return null; @@ -68,7 +68,7 @@ const ReplyPreview = React.memo(({ @@ -76,7 +76,7 @@ const ReplyPreview = React.memo(({ {useRealName ? message.u?.name : message.u?.username} {time} - {/*@ts-ignore*/} + {/* @ts-ignore*/} ({ Message_TimeFormat: state.settings.Message_TimeFormat, baseUrl: state.server.server, - useRealName: state.settings.UI_Use_Real_Name + useRealName: state.settings.UI_Use_Real_Name, }); export default connect(mapStateToProps)(ReplyPreview); diff --git a/app/containers/MessageBox/RightButtons.android.tsx b/app/containers/MessageBox/RightButtons.android.tsx index db4d9e913..7b8dc8ca8 100644 --- a/app/containers/MessageBox/RightButtons.android.tsx +++ b/app/containers/MessageBox/RightButtons.android.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { View } from 'react-native'; -import { SendButton, ActionsButton } from './buttons'; +import { ActionsButton, SendButton } from './buttons'; import styles from './styles'; interface IMessageBoxRightButtons { @@ -13,7 +13,7 @@ interface IMessageBoxRightButtons { } const RightButtons = React.memo(({ - theme, showSend, submit, showMessageBoxActions, isActionsEnabled + theme, showSend, submit, showMessageBoxActions, isActionsEnabled, }: IMessageBoxRightButtons) => { if (showSend) { return ; diff --git a/app/containers/MessageBox/RightButtons.ios.tsx b/app/containers/MessageBox/RightButtons.ios.tsx index 8db0e68ee..c295d37dc 100644 --- a/app/containers/MessageBox/RightButtons.ios.tsx +++ b/app/containers/MessageBox/RightButtons.ios.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import { SendButton } from './buttons'; interface IMessageBoxRightButtons { diff --git a/app/containers/MessageBox/buttons/ActionsButton.tsx b/app/containers/MessageBox/buttons/ActionsButton.tsx index 6b230d3e5..de7eb9b4c 100644 --- a/app/containers/MessageBox/buttons/ActionsButton.tsx +++ b/app/containers/MessageBox/buttons/ActionsButton.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import BaseButton from './BaseButton'; interface IActionsButton { diff --git a/app/containers/MessageBox/buttons/CancelEditingButton.tsx b/app/containers/MessageBox/buttons/CancelEditingButton.tsx index f57a2ac61..4d7eeea35 100644 --- a/app/containers/MessageBox/buttons/CancelEditingButton.tsx +++ b/app/containers/MessageBox/buttons/CancelEditingButton.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import BaseButton from './BaseButton'; interface ICancelEditingButton { diff --git a/app/containers/MessageBox/buttons/SendButton.tsx b/app/containers/MessageBox/buttons/SendButton.tsx index b144d4982..7f24ad7e8 100644 --- a/app/containers/MessageBox/buttons/SendButton.tsx +++ b/app/containers/MessageBox/buttons/SendButton.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import BaseButton from './BaseButton'; import { themes } from '../../../constants/colors'; diff --git a/app/containers/MessageBox/buttons/ToggleEmojiButton.tsx b/app/containers/MessageBox/buttons/ToggleEmojiButton.tsx index c1914d9e1..cd04fff14 100644 --- a/app/containers/MessageBox/buttons/ToggleEmojiButton.tsx +++ b/app/containers/MessageBox/buttons/ToggleEmojiButton.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import BaseButton from './BaseButton'; interface IToggleEmojiButton { diff --git a/app/containers/MessageBox/buttons/index.ts b/app/containers/MessageBox/buttons/index.ts index 523764469..8d131d92b 100644 --- a/app/containers/MessageBox/buttons/index.ts +++ b/app/containers/MessageBox/buttons/index.ts @@ -7,5 +7,5 @@ export { CancelEditingButton, ToggleEmojiButton, SendButton, - ActionsButton + ActionsButton, }; diff --git a/app/containers/MessageBox/index.tsx b/app/containers/MessageBox/index.tsx index 95b5b00ae..b88173c95 100644 --- a/app/containers/MessageBox/index.tsx +++ b/app/containers/MessageBox/index.tsx @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import {View, Alert, Keyboard, Text, NativeModules} from 'react-native'; +import { Alert, Keyboard, NativeModules, Text, View } from 'react-native'; import { connect } from 'react-redux'; import { KeyboardAccessoryView } from 'react-native-ui-lib/keyboard'; import ImagePicker from 'react-native-image-crop-picker'; @@ -15,33 +15,35 @@ import RocketChat from '../../lib/rocketchat'; import styles from './styles'; import database from '../../lib/database'; import { emojis } from '../../emojis'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import RecordAudio from './RecordAudio'; import I18n from '../../i18n'; import ReplyPreview from './ReplyPreview'; import debounce from '../../utils/debounce'; import { themes } from '../../constants/colors'; // @ts-ignore +// eslint-disable-next-line import/extensions,import/no-unresolved 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 { KEY_COMMAND, - handleCommandTyping, + handleCommandShowUpload, handleCommandSubmit, - handleCommandShowUpload + handleCommandTyping, } from '../../commands'; import Mentions from './Mentions'; import MessageboxContext from './Context'; import { - MENTIONS_TRACKING_TYPE_EMOJIS, - MENTIONS_TRACKING_TYPE_COMMANDS, MENTIONS_COUNT_TO_DISPLAY, + MENTIONS_TRACKING_TYPE_COMMANDS, + MENTIONS_TRACKING_TYPE_EMOJIS, + MENTIONS_TRACKING_TYPE_ROOMS, MENTIONS_TRACKING_TYPE_USERS, - MENTIONS_TRACKING_TYPE_ROOMS } from './constants'; import CommandsPreview from './CommandsPreview'; import { getUserSelector } from '../../selectors/login'; @@ -58,17 +60,17 @@ const imagePickerConfig = { cropping: true, compressImageQuality: 0.8, avoidEmptySpaceAroundImage: false, - freeStyleCropEnabled: true + freeStyleCropEnabled: true, }; const libraryPickerConfig = { multiple: true, compressVideoPreset: 'Passthrough', - mediaType: 'any' + mediaType: 'any', }; const videoPickerConfig = { - mediaType: 'video' + mediaType: 'video', }; interface IMessageBoxProps { @@ -95,18 +97,18 @@ interface IMessageBoxProps { FileUpload_MediaTypeWhiteList: string; FileUpload_MaxFileSize: number; Message_AudioRecorderEnabled: boolean; - getCustomEmoji(): void; - editCancel(): void; - editRequest({}): void; - onSubmit({}, {}?, {}?): void; - typing({}, {}): void; + getCustomEmoji: Function; + editCancel: Function; + editRequest: Function; + onSubmit: Function; + typing: Function; theme: string; replyCancel(): void; showSend: boolean; navigation: any; children: JSX.Element; isMasterDetail: boolean; - showActionSheet({}): void; + showActionSheet: Function; iOSScrollBehavior: number; sharing: boolean; isActionsEnabled: boolean; @@ -127,31 +129,44 @@ interface IMessageBoxState { } class MessageBox extends Component { - private text: string; + private selection: { start: number; end: number }; + private focused: boolean; + private options: any; + private imagePickerConfig: any; + private libraryPickerConfig: any; + private videoPickerConfig: any; + private room: any; + private thread: any; + private unsubscribeFocus: any; + private trackingTimeout: any; + private tracking: any; + private unsubscribeBlur: any; + private component: any; + private typingTimeout: any; static defaultProps = { message: { - id: '' + id: '', }, sharing: false, iOSScrollBehavior: NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorFixedOffset, isActionsEnabled: true, - getCustomEmoji: () => {} + getCustomEmoji: () => {}, } constructor(props: IMessageBoxProps) { @@ -165,7 +180,7 @@ class MessageBox extends Component { commandPreview: [], showCommandPreview: false, command: {}, - tshow: false + tshow: false, }; this.text = ''; this.selection = { start: 0, end: 0 }; @@ -176,49 +191,49 @@ class MessageBox extends Component { { title: I18n.t('Take_a_photo'), icon: 'camera-photo', - onPress: this.takePhoto + onPress: this.takePhoto, }, { title: I18n.t('Take_a_video'), icon: 'camera', - onPress: this.takeVideo + onPress: this.takeVideo, }, { title: I18n.t('Choose_from_library'), icon: 'image', - onPress: this.chooseFromLibrary + onPress: this.chooseFromLibrary, }, { title: I18n.t('Choose_file'), icon: 'attach', - onPress: this.chooseFile + onPress: this.chooseFile, }, { title: I18n.t('Create_Discussion'), icon: 'discussions', - onPress: this.createDiscussion - } + onPress: this.createDiscussion, + }, ]; const libPickerLabels = { cropperChooseText: I18n.t('Choose'), cropperCancelText: I18n.t('Cancel'), - loadingLabelText: I18n.t('Processing') + loadingLabelText: I18n.t('Processing'), }; this.imagePickerConfig = { ...imagePickerConfig, - ...libPickerLabels + ...libPickerLabels, }; this.libraryPickerConfig = { ...libraryPickerConfig, - ...libPickerLabels + ...libPickerLabels, }; this.videoPickerConfig = { ...videoPickerConfig, - ...libPickerLabels + ...libPickerLabels, }; } @@ -302,11 +317,11 @@ class MessageBox extends Component { shouldComponentUpdate(nextProps: any, nextState: any) { const { - showEmojiKeyboard, showSend, recording, mentions, commandPreview, tshow + showEmojiKeyboard, showSend, recording, mentions, commandPreview, tshow, } = this.state; const { - roomType, replying, editing, isFocused, message, theme + roomType, replying, editing, isFocused, message, theme, } = this.props; if (nextProps.theme !== theme) { @@ -388,7 +403,7 @@ class MessageBox extends Component { } // eslint-disable-next-line react/sort-comp - debouncedOnChangeText = debounce(async(text: any) => { + debouncedOnChangeText = debounce(async (text: any) => { const { sharing } = this.props; const isTextEmpty = text.length === 0; if (isTextEmpty) { @@ -424,15 +439,14 @@ class MessageBox extends Component { } } return this.identifyMentionKeyword(command, MENTIONS_TRACKING_TYPE_COMMANDS); - } else if (channelMention) { + } if (channelMention) { return this.identifyMentionKeyword(result, MENTIONS_TRACKING_TYPE_ROOMS); - } else if (userMention) { + } if (userMention) { return this.identifyMentionKeyword(result, MENTIONS_TRACKING_TYPE_USERS); - } else if (emojiMention) { + } if (emojiMention) { return this.identifyMentionKeyword(result, MENTIONS_TRACKING_TYPE_EMOJIS); - } else { - return this.stopTrackingMention(); } + return this.stopTrackingMention(); }, 100) onKeyboardResigned = () => { @@ -451,7 +465,7 @@ class MessageBox extends Component { const result = msg.substr(0, cursor).replace(regexp, ''); const mentionName = trackingType === MENTIONS_TRACKING_TYPE_EMOJIS ? `${ item.name || item }:` - : (item.username || item.name || item.command); + : item.username || item.name || item.command; const text = `${ result }${ mentionName } ${ msg.slice(cursor) }`; if ((trackingType === MENTIONS_TRACKING_TYPE_COMMANDS) && item.providesPreview) { @@ -467,7 +481,7 @@ class MessageBox extends Component { onPressCommandPreview = (item: any) => { const { command } = this.state; const { - rid, tmid, message: { id: messageTmid }, replyCancel + rid, tmid, message: { id: messageTmid }, replyCancel, } = this.props; const { text } = this; const name = text.substr(0, text.indexOf(' ')).slice(1); @@ -500,7 +514,7 @@ class MessageBox extends Component { this.setShowSend(true); } - getPermalink = async(message: any) => { + getPermalink = async (message: any) => { try { return await RocketChat.getPermalinkMessage(message); } catch (error) { @@ -519,18 +533,18 @@ class MessageBox extends Component { return result; } - getUsers = debounce(async(keyword: any) => { + getUsers = debounce(async (keyword: any) => { let res = await RocketChat.search({ text: keyword, filterRooms: false, filterUsers: true }); res = [...this.getFixedMentions(keyword), ...res]; this.setState({ mentions: res }); }, 300) - getRooms = debounce(async(keyword = '') => { + getRooms = debounce(async (keyword = '') => { const res = await RocketChat.search({ text: keyword, filterRooms: true, filterUsers: false }); this.setState({ mentions: res }); }, 300) - getEmojis = debounce(async(keyword: any) => { + getEmojis = debounce(async (keyword: any) => { const db = database.active; const customEmojisCollection = db.get('custom_emojis'); const likeString = sanitizeLikeString(keyword); @@ -540,17 +554,17 @@ class MessageBox extends Component { } let customEmojis = await customEmojisCollection.query(...whereClause).fetch(); customEmojis = customEmojis.slice(0, MENTIONS_COUNT_TO_DISPLAY); - const filteredEmojis = emojis.filter(emoji => emoji.indexOf(keyword) !== -1).slice(0, MENTIONS_COUNT_TO_DISPLAY); + const filteredEmojis = emojis.filter((emoji) => emoji.indexOf(keyword) !== -1).slice(0, MENTIONS_COUNT_TO_DISPLAY); const mergedEmojis = [...customEmojis, ...filteredEmojis].slice(0, MENTIONS_COUNT_TO_DISPLAY); this.setState({ mentions: mergedEmojis || [] }); }, 300) - getSlashCommands = debounce(async(keyword: any) => { + getSlashCommands = debounce(async (keyword: any) => { const db = database.active; const commandsCollection = db.get('slash_commands'); const likeString = sanitizeLikeString(keyword); const commands = await commandsCollection.query( - Q.where('id', Q.like(`${ likeString }%`)) + Q.where('id', Q.like(`${ likeString }%`)), ).fetch(); this.setState({ mentions: commands || [] }); }, 300) @@ -585,7 +599,7 @@ class MessageBox extends Component { }, 1000); } - setCommandPreview = async(command: any, name: string, params: any) => { + setCommandPreview = async (command: any, name: string, params: any) => { const { rid } = this.props; try { const { success, preview } = await RocketChat.getCommandPreview(name, rid, params); @@ -630,7 +644,7 @@ class MessageBox extends Component { return false; } - takePhoto = async() => { + takePhoto = async () => { logEvent(events.ROOM_BOX_ACTION_PHOTO); try { const image = await ImagePicker.openCamera(this.imagePickerConfig); @@ -642,7 +656,7 @@ class MessageBox extends Component { } } - takeVideo = async() => { + takeVideo = async () => { logEvent(events.ROOM_BOX_ACTION_VIDEO); try { const video = await ImagePicker.openCamera(this.videoPickerConfig); @@ -654,7 +668,7 @@ class MessageBox extends Component { } } - chooseFromLibrary = async() => { + chooseFromLibrary = async () => { logEvent(events.ROOM_BOX_ACTION_LIBRARY); try { const attachments = await ImagePicker.openPicker(this.libraryPickerConfig); @@ -664,17 +678,17 @@ class MessageBox extends Component { } } - chooseFile = async() => { + chooseFile = async () => { logEvent(events.ROOM_BOX_ACTION_FILE); try { const res = await DocumentPicker.pick({ - type: [DocumentPicker.types.allFiles] + type: [DocumentPicker.types.allFiles], }); const file = { filename: res.name, size: res.size, mime: res.type, - path: res.uri + path: res.uri, }; if (this.canUploadFile(file)) { this.openShareView([file]); @@ -730,9 +744,9 @@ class MessageBox extends Component { this.setState({ recording }); } - finishAudioMessage = async(fileInfo: any) => { + finishAudioMessage = async (fileInfo: any) => { const { - rid, tmid, baseUrl: server, user + rid, tmid, baseUrl: server, user, } = this.props; if (fileInfo) { @@ -750,10 +764,10 @@ class MessageBox extends Component { this.setState({ showEmojiKeyboard: false }); } - submit = async() => { + submit = async () => { const { tshow } = this.state; const { - onSubmit, rid: roomId, tmid, showSend, sharing + onSubmit, rid: roomId, tmid, showSend, sharing, } = this.props; const message = this.text; @@ -773,7 +787,7 @@ class MessageBox extends Component { } const { - editing, replying, message: { id: messageTmid }, replyCancel + editing, replying, message: { id: messageTmid }, replyCancel, } = this.props; // Slash command @@ -783,7 +797,7 @@ class MessageBox extends Component { const command = message.replace(/ .*/, '').slice(1); const likeString = sanitizeLikeString(command); const slashCommand = await commandsCollection.query( - Q.where('id', Q.like(`${ likeString }%`)) + Q.where('id', Q.like(`${ likeString }%`)), ).fetch(); if (slashCommand.length > 0) { logEvent(events.COMMAND_RUN); @@ -811,7 +825,7 @@ class MessageBox extends Component { // Reply } else if (replying) { const { - message: replyingMessage, threadsEnabled, replyWithMention + message: replyingMessage, threadsEnabled, replyWithMention, } = this.props; // Thread @@ -856,7 +870,7 @@ class MessageBox extends Component { identifyMentionKeyword = (keyword: any, type: string) => { this.setState({ showEmojiKeyboard: false, - trackingType: type + trackingType: type, }); this.updateMentions(keyword, type); } @@ -870,7 +884,7 @@ class MessageBox extends Component { mentions: [], trackingType: '', commandPreview: [], - showCommandPreview: false + showCommandPreview: false, }); } @@ -912,16 +926,16 @@ class MessageBox extends Component { renderContent = () => { const { - recording, showEmojiKeyboard, showSend, mentions, trackingType, commandPreview, showCommandPreview + recording, showEmojiKeyboard, showSend, mentions, trackingType, commandPreview, showCommandPreview, } = this.state; const { - editing, message, replying, replyCancel, user, getCustomEmoji, theme, Message_AudioRecorderEnabled, children, isActionsEnabled, tmid + editing, message, replying, replyCancel, user, getCustomEmoji, theme, Message_AudioRecorderEnabled, children, isActionsEnabled, tmid, } = this.props; const isAndroidTablet = isTablet && isAndroid ? { multiline: false, onSubmitEditing: this.submit, - returnKeyType: 'send' + returnKeyType: 'send', } : {}; const recordAudio = showSend || !Message_AudioRecorderEnabled ? null : ( @@ -935,7 +949,7 @@ class MessageBox extends Component { const commandsPreviewAndMentions = !recording ? ( <> - {/*@ts-ignore*/} + {/* @ts-ignore*/} ) : null; @@ -965,11 +979,11 @@ class MessageBox extends Component { isActionsEnabled={isActionsEnabled} /> this.component = component} - //@ts-ignore + ref={(component) => this.component = component} + // @ts-ignore style={[styles.textBoxInput, { color: themes[theme].bodyText }]} returnKeyType='default' - //@ts-ignore + // @ts-ignore keyboardType='twitter' blurOnSubmit={false} placeholder={I18n.t('New_Message')} @@ -1002,7 +1016,7 @@ class MessageBox extends Component { style={[ styles.textArea, { backgroundColor: themes[theme].messageboxBackground }, - !recording && editing && { backgroundColor: themes[theme].chatComponentBackground } + !recording && editing && { backgroundColor: themes[theme].chatComponentBackground }, ]} testID='messagebox' > @@ -1020,7 +1034,7 @@ class MessageBox extends Component { console.count(`${ this.constructor.name }.render calls`); const { showEmojiKeyboard } = this.state; const { - user, baseUrl, theme, iOSScrollBehavior + user, baseUrl, theme, iOSScrollBehavior, } = this.props; return ( { user, baseUrl, onPressMention: this.onPressMention, - onPressCommandPreview: this.onPressCommandPreview + onPressCommandPreview: this.onPressCommandPreview, }} > ({ user: getUserSelector(state), FileUpload_MediaTypeWhiteList: state.settings.FileUpload_MediaTypeWhiteList, FileUpload_MaxFileSize: state.settings.FileUpload_MaxFileSize, - Message_AudioRecorderEnabled: state.settings.Message_AudioRecorderEnabled + Message_AudioRecorderEnabled: state.settings.Message_AudioRecorderEnabled, }); -const dispatchToProps = ({ - typing: (rid: any, status: any) => userTypingAction(rid, status) -}); +const dispatchToProps = { + typing: (rid: any, status: any) => userTypingAction(rid, status), +}; // @ts-ignore export default connect(mapStateToProps, dispatchToProps, null, { forwardRef: true })(withActionSheet(MessageBox)); diff --git a/app/containers/MessageBox/styles.ts b/app/containers/MessageBox/styles.ts index 9c5a2ff52..3e28ac180 100644 --- a/app/containers/MessageBox/styles.ts +++ b/app/containers/MessageBox/styles.ts @@ -9,12 +9,12 @@ const SCROLLVIEW_MENTION_HEIGHT = 4 * MENTION_HEIGHT; export default StyleSheet.create({ composer: { flexDirection: 'column', - borderTopWidth: 1 + borderTopWidth: 1, }, textArea: { flexDirection: 'row', alignItems: 'center', - flexGrow: 0 + flexGrow: 0, }, textBoxInput: { textAlignVertical: 'center', @@ -28,48 +28,48 @@ export default StyleSheet.create({ paddingRight: 0, fontSize: 16, letterSpacing: 0, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, actionButton: { alignItems: 'center', justifyContent: 'center', width: 60, - height: 48 + height: 48, }, mentionList: { - maxHeight: MENTION_HEIGHT * 4 + maxHeight: MENTION_HEIGHT * 4, }, mentionItem: { height: MENTION_HEIGHT, borderTopWidth: StyleSheet.hairlineWidth, flexDirection: 'row', alignItems: 'center', - paddingHorizontal: 5 + paddingHorizontal: 5, }, mentionItemCustomEmoji: { margin: 8, width: 30, - height: 30 + height: 30, }, mentionItemEmoji: { width: 46, height: 36, fontSize: isIOS ? 30 : 25, - ...sharedStyles.textAlignCenter + ...sharedStyles.textAlignCenter, }, fixedMentionAvatar: { width: 46, fontSize: 14, ...sharedStyles.textBold, - ...sharedStyles.textAlignCenter + ...sharedStyles.textAlignCenter, }, mentionText: { fontSize: 14, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, emojiKeyboardContainer: { flex: 1, - borderTopWidth: StyleSheet.hairlineWidth + borderTopWidth: StyleSheet.hairlineWidth, }, slash: { height: 30, @@ -77,48 +77,48 @@ export default StyleSheet.create({ padding: 5, paddingHorizontal: 12, marginHorizontal: 10, - borderRadius: 2 + borderRadius: 2, }, commandPreviewImage: { justifyContent: 'center', margin: 3, width: 120, height: 80, - borderRadius: 4 + borderRadius: 4, }, commandPreview: { height: 100, flex: 1, flexDirection: 'row', - alignItems: 'center' + alignItems: 'center', }, avatar: { - margin: 8 + margin: 8, }, scrollViewMention: { - maxHeight: SCROLLVIEW_MENTION_HEIGHT + maxHeight: SCROLLVIEW_MENTION_HEIGHT, }, recordingContent: { flexDirection: 'row', flex: 1, - justifyContent: 'space-between' + justifyContent: 'space-between', }, recordingCancelText: { fontSize: 16, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, buttonsWhitespace: { - width: 15 + width: 15, }, sendToChannelButton: { flexDirection: 'row', alignItems: 'center', paddingVertical: 8, - paddingHorizontal: 18 + paddingHorizontal: 18, }, sendToChannelText: { fontSize: 12, marginLeft: 4, - ...sharedStyles.textRegular - } + ...sharedStyles.textRegular, + }, }); diff --git a/app/containers/MessageErrorActions.tsx b/app/containers/MessageErrorActions.tsx index b9fa0665c..80c2efc42 100644 --- a/app/containers/MessageErrorActions.tsx +++ b/app/containers/MessageErrorActions.tsx @@ -1,4 +1,4 @@ -import { useImperativeHandle, forwardRef } from 'react'; +import { forwardRef, useImperativeHandle } from 'react'; import RocketChat from '../lib/rocketchat'; import database from '../lib/database'; @@ -10,11 +10,11 @@ import log from '../utils/log'; const MessageErrorActions = forwardRef(({ tmid }: any, ref): any => { const { showActionSheet }: any = useActionSheet(); - const handleResend = protectedFunction(async(message: any) => { + const handleResend = protectedFunction(async (message: any) => { await RocketChat.resendMessage(message, tmid); }); - const handleDelete = async(message: any) => { + const handleDelete = async (message: any) => { try { const db = database.active; const deleteBatch: any = []; @@ -41,7 +41,7 @@ const MessageErrorActions = forwardRef(({ tmid }: any, ref): any => { msg.prepareUpdate((m: any) => { m.tcount = null; m.tlm = null; - }) + }), ); try { @@ -55,14 +55,14 @@ const MessageErrorActions = forwardRef(({ tmid }: any, ref): any => { deleteBatch.push( msg.prepareUpdate((m: any) => { m.tcount -= 1; - }) + }), ); } } catch { // Do nothing: message not found } } - await db.action(async() => { + await db.action(async () => { await db.batch(...deleteBatch); }); } catch (e) { @@ -76,21 +76,21 @@ const MessageErrorActions = forwardRef(({ tmid }: any, ref): any => { { title: I18n.t('Resend'), icon: 'send', - onPress: () => handleResend(message) + onPress: () => handleResend(message), }, { title: I18n.t('Delete'), icon: 'delete', danger: true, - onPress: () => handleDelete(message) - } + onPress: () => handleDelete(message), + }, ], - hasCancel: true + hasCancel: true, }); }; useImperativeHandle(ref, () => ({ - showMessageErrorActions + showMessageErrorActions, })); return null; diff --git a/app/containers/OrSeparator.tsx b/app/containers/OrSeparator.tsx index 957a0ce4f..a9d01e73c 100644 --- a/app/containers/OrSeparator.tsx +++ b/app/containers/OrSeparator.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import I18n from '../i18n'; import sharedStyles from '../views/Styles'; @@ -9,18 +9,18 @@ const styles = StyleSheet.create({ container: { flexDirection: 'row', alignItems: 'center', - marginVertical: 24 + marginVertical: 24, }, line: { height: 1, - flex: 1 + flex: 1, }, text: { fontSize: 14, marginLeft: 14, marginRight: 14, - ...sharedStyles.textMedium - } + ...sharedStyles.textMedium, + }, }); interface IOrSeparator { diff --git a/app/containers/Passcode/Base/Button.tsx b/app/containers/Passcode/Base/Button.tsx index 53f41e383..76c31761d 100644 --- a/app/containers/Passcode/Base/Button.tsx +++ b/app/containers/Passcode/Base/Button.tsx @@ -11,7 +11,7 @@ interface IPasscodeButton { icon: string; theme: string; disabled: boolean; - onPress({}?): void; + onPress: Function; } const Button = React.memo(({ text, disabled, theme, onPress, icon }: Partial) => { diff --git a/app/containers/Passcode/Base/Dots.tsx b/app/containers/Passcode/Base/Dots.tsx index 415d783c3..db984a95b 100644 --- a/app/containers/Passcode/Base/Dots.tsx +++ b/app/containers/Passcode/Base/Dots.tsx @@ -17,7 +17,7 @@ interface IPasscodeDots { const Dots = React.memo(({ passcode, theme, length }: IPasscodeDots) => ( {range(length).map((val) => { - const lengthSup = (passcode.length >= val + 1); + const lengthSup = passcode.length >= val + 1; const height = lengthSup ? SIZE_FULL : SIZE_EMPTY; const width = lengthSup ? SIZE_FULL : SIZE_EMPTY; let backgroundColor = ''; @@ -38,7 +38,7 @@ const Dots = React.memo(({ passcode, theme, length }: IPasscodeDots) => ( borderRadius, backgroundColor, marginRight, - marginLeft + marginLeft, }} /> diff --git a/app/containers/Passcode/Base/Locked.tsx b/app/containers/Passcode/Base/Locked.tsx index f20c3e850..0b1562dd1 100644 --- a/app/containers/Passcode/Base/Locked.tsx +++ b/app/containers/Passcode/Base/Locked.tsx @@ -4,7 +4,7 @@ import { Grid } from 'react-native-easy-grid'; import { themes } from '../../../constants/colors'; import { resetAttempts } from '../../../utils/localAuthentication'; import { TYPE } from '../constants'; -import { getLockedUntil, getDiff } from '../utils'; +import { getDiff, getLockedUntil } from '../utils'; import I18n from '../../../i18n'; import styles from './styles'; import Title from './Title'; @@ -52,7 +52,7 @@ const Timer = React.memo(({ time, theme, setStatus }: IPasscodeTimer) => { const Locked = React.memo(({ theme, setStatus }: IPasscodeLocked) => { const [lockedUntil, setLockedUntil] = useState(null); - const readItemFromStorage = async() => { + const readItemFromStorage = async () => { const l = await getLockedUntil(); setLockedUntil(l); }; @@ -62,7 +62,7 @@ const Locked = React.memo(({ theme, setStatus }: IPasscodeLocked) => { }, []); return ( - //TODO - verify if this 'r' it's correct + // TODO - verify if this 'r' it's correct // @ts-ignore diff --git a/app/containers/Passcode/Base/Subtitle.tsx b/app/containers/Passcode/Base/Subtitle.tsx index 0959d6a4d..76a5a7405 100644 --- a/app/containers/Passcode/Base/Subtitle.tsx +++ b/app/containers/Passcode/Base/Subtitle.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import { Row } from 'react-native-easy-grid'; import styles from './styles'; diff --git a/app/containers/Passcode/Base/Title.tsx b/app/containers/Passcode/Base/Title.tsx index fdb73b4a4..0c54e0358 100644 --- a/app/containers/Passcode/Base/Title.tsx +++ b/app/containers/Passcode/Base/Title.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import { Row } from 'react-native-easy-grid'; import styles from './styles'; diff --git a/app/containers/Passcode/Base/index.tsx b/app/containers/Passcode/Base/index.tsx index b861a4f08..102d1c99b 100644 --- a/app/containers/Passcode/Base/index.tsx +++ b/app/containers/Passcode/Base/index.tsx @@ -1,5 +1,5 @@ -import React, { useState, forwardRef, useImperativeHandle, useRef } from 'react'; -import { Col, Row, Grid } from 'react-native-easy-grid'; +import React, { forwardRef, useImperativeHandle, useRef, useState } from 'react'; +import { Col, Grid, Row } from 'react-native-easy-grid'; import range from 'lodash/range'; import * as Animatable from 'react-native-animatable'; import * as Haptics from 'expo-haptics'; @@ -27,7 +27,7 @@ interface IPasscodeBase { } const Base = forwardRef(({ - theme, type, onEndProcess, previousPasscode, title, subtitle, onError, showBiometry, onBiometryPress + theme, type, onEndProcess, previousPasscode, title, subtitle, onError, showBiometry, onBiometryPress, }: IPasscodeBase, ref) => { const rootRef = useRef(); const dotsRef = useRef(); @@ -78,7 +78,7 @@ const Base = forwardRef(({ }); useImperativeHandle(ref, () => ({ - wrongPasscode, animate, clearPasscode + wrongPasscode, animate, clearPasscode, })); return ( diff --git a/app/containers/Passcode/Base/styles.ts b/app/containers/Passcode/Base/styles.ts index 252e5a854..45f6e46f2 100644 --- a/app/containers/Passcode/Base/styles.ts +++ b/app/containers/Passcode/Base/styles.ts @@ -4,22 +4,22 @@ import sharedStyles from '../../../views/Styles'; export default StyleSheet.create({ container: { - flex: 1 + flex: 1, }, titleView: { - justifyContent: 'center' + justifyContent: 'center', }, subtitleView: { justifyContent: 'center', - height: 32 + height: 32, }, row: { flex: 0, alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, buttonRow: { - height: 102 + height: 102, }, colButton: { flex: 0, @@ -27,44 +27,44 @@ export default StyleSheet.create({ marginRight: 12, alignItems: 'center', width: 78, - height: 78 + height: 78, }, buttonText: { fontSize: 28, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, buttonView: { alignItems: 'center', justifyContent: 'center', width: 78, height: 78, - borderRadius: 4 + borderRadius: 4, }, textTitle: { fontSize: 22, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, textSubtitle: { fontSize: 16, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, dotsContainer: { flexDirection: 'row', justifyContent: 'center', alignItems: 'center', marginTop: 24, - marginBottom: 40 + marginBottom: 40, }, dotsView: { justifyContent: 'center', alignItems: 'center', - height: 16 + height: 16, }, grid: { justifyContent: 'center', - flexDirection: 'column' + flexDirection: 'column', }, iconView: { - marginVertical: 16 - } + marginVertical: 16, + }, }); diff --git a/app/containers/Passcode/PasscodeChoose.tsx b/app/containers/Passcode/PasscodeChoose.tsx index 70cb00838..2ba707a09 100644 --- a/app/containers/Passcode/PasscodeChoose.tsx +++ b/app/containers/Passcode/PasscodeChoose.tsx @@ -1,4 +1,4 @@ -import React, { useState, useRef } from 'react'; +import React, { useRef, useState } from 'react'; import * as Haptics from 'expo-haptics'; import { gestureHandlerRootHOC } from 'react-native-gesture-handler'; diff --git a/app/containers/Passcode/PasscodeEnter.tsx b/app/containers/Passcode/PasscodeEnter.tsx index 31fb809b0..d0728401a 100644 --- a/app/containers/Passcode/PasscodeEnter.tsx +++ b/app/containers/Passcode/PasscodeEnter.tsx @@ -8,10 +8,10 @@ import Base from './Base'; import Locked from './Base/Locked'; import { TYPE } from './constants'; import { - ATTEMPTS_KEY, LOCKED_OUT_TIMER_KEY, PASSCODE_KEY, MAX_ATTEMPTS + ATTEMPTS_KEY, LOCKED_OUT_TIMER_KEY, MAX_ATTEMPTS, PASSCODE_KEY, } from '../../constants/localAuthentication'; -import { resetAttempts, biometryAuth } from '../../utils/localAuthentication'; -import { getLockedUntil, getDiff } from './utils'; +import { biometryAuth, resetAttempts } from '../../utils/localAuthentication'; +import { getDiff, getLockedUntil } from './utils'; import UserPreferences from '../../lib/userPreferences'; import I18n from '../../i18n'; @@ -31,12 +31,12 @@ const PasscodeEnter = ({ theme, hasBiometry, finishProcess }: IPasscodePasscodeE const { getItem: getAttempts, setItem: setAttempts } = useAsyncStorage(ATTEMPTS_KEY); const { setItem: setLockedUntil } = useAsyncStorage(LOCKED_OUT_TIMER_KEY); - const fetchPasscode = async() => { + const fetchPasscode = async () => { const p: any = await UserPreferences.getStringAsync(PASSCODE_KEY); setPasscode(p); }; - const biometry = async() => { + const biometry = async () => { if (hasBiometry && status === TYPE.ENTER) { const result = await biometryAuth(); if (result?.success) { @@ -45,7 +45,7 @@ const PasscodeEnter = ({ theme, hasBiometry, finishProcess }: IPasscodePasscodeE } }; - const readStorage = async() => { + const readStorage = async () => { lockedUntil = await getLockedUntil(); if (lockedUntil) { const diff = getDiff(lockedUntil); diff --git a/app/containers/Passcode/constants.ts b/app/containers/Passcode/constants.ts index ae268799a..d07dc67fd 100644 --- a/app/containers/Passcode/constants.ts +++ b/app/containers/Passcode/constants.ts @@ -2,5 +2,5 @@ export const TYPE: any = { CHOOSE: 'choose', CONFIRM: 'confirm', ENTER: 'enter', - LOCKED: 'locked' + LOCKED: 'locked', }; diff --git a/app/containers/Passcode/utils.ts b/app/containers/Passcode/utils.ts index f333c6691..07b8a949d 100644 --- a/app/containers/Passcode/utils.ts +++ b/app/containers/Passcode/utils.ts @@ -3,7 +3,7 @@ import moment from 'moment'; import { LOCKED_OUT_TIMER_KEY, TIME_TO_LOCK } from '../../constants/localAuthentication'; -export const getLockedUntil = async() => { +export const getLockedUntil = async () => { const t: any = await AsyncStorage.getItem(LOCKED_OUT_TIMER_KEY); if (t) { return moment(t).add(TIME_TO_LOCK); @@ -11,4 +11,4 @@ export const getLockedUntil = async() => { return null; }; // @ts-ignore -export const getDiff = t => new Date(t) - new Date(); +export const getDiff = (t) => new Date(t) - new Date(); diff --git a/app/containers/ReactionsModal.tsx b/app/containers/ReactionsModal.tsx index dde7a3373..aac8c4a5e 100644 --- a/app/containers/ReactionsModal.tsx +++ b/app/containers/ReactionsModal.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text, FlatList, StyleSheet } from 'react-native'; +import { FlatList, StyleSheet, Text, View } from 'react-native'; import Modal from 'react-native-modal'; import Touchable from 'react-native-platform-touchable'; @@ -13,48 +13,48 @@ import SafeAreaView from './SafeAreaView'; const styles = StyleSheet.create({ safeArea: { - backgroundColor: 'transparent' + backgroundColor: 'transparent', }, titleContainer: { alignItems: 'center', - paddingVertical: 10 + paddingVertical: 10, }, title: { fontSize: 16, ...sharedStyles.textSemibold, - ...sharedStyles.textAlignCenter + ...sharedStyles.textAlignCenter, }, reactCount: { fontSize: 13, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, peopleReacted: { fontSize: 14, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, peopleItemContainer: { flex: 1, flexDirection: 'column', - justifyContent: 'center' + justifyContent: 'center', }, emojiContainer: { width: 50, height: 50, alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, itemContainer: { height: 50, - flexDirection: 'row' + flexDirection: 'row', }, listContainer: { - flex: 1 + flex: 1, }, closeButton: { position: 'absolute', left: 0, - top: 10 - } + top: 10, + }, }); const standardEmojiStyle = { fontSize: 20 }; const customEmojiStyle = { width: 20, height: 20 }; @@ -132,7 +132,7 @@ const ModalContent = React.memo(({ message, onClose, ...props }: IModalContent) style={styles.listContainer} data={message.reactions} renderItem={({ item }) => } - keyExtractor={item => item.emoji} + keyExtractor={(item) => item.emoji} /> ); @@ -149,7 +149,7 @@ const ReactionsModal = React.memo(({ isVisible, onClose, theme, ...props }: IRea onSwipeComplete={onClose} swipeDirection={['up', 'left', 'right', 'down']} > - {/*@ts-ignore*/} + {/* @ts-ignore*/} ), (prevProps, nextProps) => prevProps.isVisible === nextProps.isVisible && prevProps.theme === nextProps.theme); diff --git a/app/containers/RoomHeader/RoomHeader.stories.js b/app/containers/RoomHeader/RoomHeader.stories.js index bfea5e272..a8ddfd4be 100644 --- a/app/containers/RoomHeader/RoomHeader.stories.js +++ b/app/containers/RoomHeader/RoomHeader.stories.js @@ -1,12 +1,12 @@ /* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions, react/prop-types, react/destructuring-assignment */ import React from 'react'; -import { View, Dimensions } from 'react-native'; +import { Dimensions, View } from 'react-native'; import { storiesOf } from '@storybook/react-native'; -import RoomHeaderComponent from './RoomHeader'; import Header from '../Header'; import { longText } from '../../../storybook/utils'; import { ThemeContext } from '../../theme'; +import RoomHeaderComponent from './RoomHeader'; const stories = storiesOf('RoomHeader', module); diff --git a/app/containers/RoomHeader/RoomHeader.tsx b/app/containers/RoomHeader/RoomHeader.tsx index 33b0d37cf..e09f74c45 100644 --- a/app/containers/RoomHeader/RoomHeader.tsx +++ b/app/containers/RoomHeader/RoomHeader.tsx @@ -1,5 +1,5 @@ import React, { useCallback } from 'react'; -import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; +import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import I18n from '../../i18n'; import sharedStyles from '../../views/Styles'; @@ -9,7 +9,7 @@ import RoomTypeIcon from '../RoomTypeIcon'; import { withTheme } from '../../theme'; const HIT_SLOP = { - top: 5, right: 5, bottom: 5, left: 5 + top: 5, right: 5, bottom: 5, left: 5, }; const TITLE_SIZE = 16; const SUBTITLE_SIZE = 12; @@ -19,23 +19,23 @@ const getSubTitleSize = (scale: number) => SUBTITLE_SIZE * scale; const styles = StyleSheet.create({ container: { flex: 1, - justifyContent: 'center' + justifyContent: 'center', }, titleContainer: { alignItems: 'center', - flexDirection: 'row' + flexDirection: 'row', }, title: { flexShrink: 1, - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, subtitle: { flexShrink: 1, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, typingUsers: { - ...sharedStyles.textSemibold - } + ...sharedStyles.textSemibold, + }, }); type TRoomHeaderSubTitle = { @@ -141,7 +141,7 @@ const HeaderTitle = React.memo(({ title, tmid, prid, scale, theme, testID }: TRo }); const Header = React.memo(({ - title, subtitle, parentTitle, type, status, width, height, prid, tmid, onPress, theme, isGroupChat, teamMain, testID, usersTyping = [] + title, subtitle, parentTitle, type, status, width, height, prid, tmid, onPress, theme, isGroupChat, teamMain, testID, usersTyping = [], }: IRoomHeader) => { const portrait = height > width; let scale = 1; diff --git a/app/containers/RoomHeader/index.tsx b/app/containers/RoomHeader/index.tsx index 454494118..5d18b2ef3 100644 --- a/app/containers/RoomHeader/index.tsx +++ b/app/containers/RoomHeader/index.tsx @@ -29,10 +29,9 @@ interface IRoomHeaderContainerProps { } class RoomHeaderContainer extends Component { - shouldComponentUpdate(nextProps: IRoomHeaderContainerProps) { const { - type, title, subtitle, status, statusText, connecting, connected, onPress, usersTyping, width, height, teamMain + type, title, subtitle, status, statusText, connecting, connected, onPress, usersTyping, width, height, teamMain, } = this.props; if (nextProps.type !== type) { return true; @@ -93,7 +92,7 @@ class RoomHeaderContainer extends Component { height, parentTitle, isGroupChat, - testID + testID, } = this.props; let subtitle; @@ -147,7 +146,7 @@ const mapStateToProps = (state: any, ownProps: any) => { connected: state.meteor.connected, usersTyping: state.usersTyping, status, - statusText + statusText, }; }; diff --git a/app/containers/RoomTypeIcon.tsx b/app/containers/RoomTypeIcon.tsx index 459649a66..ff0cedfc0 100644 --- a/app/containers/RoomTypeIcon.tsx +++ b/app/containers/RoomTypeIcon.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { StyleSheet } from 'react-native'; + import { CustomIcon } from '../lib/Icons'; import { STATUS_COLORS, themes } from '../constants/colors'; import Status from './Status/Status'; @@ -7,8 +8,8 @@ import { withTheme } from '../theme'; const styles = StyleSheet.create({ icon: { - marginRight: 4 - } + marginRight: 4, + }, }); interface IRoomTypeIcon { @@ -22,7 +23,7 @@ interface IRoomTypeIcon { } const RoomTypeIcon = React.memo(({ - type, isGroupChat, status, style, theme, teamMain, size = 16 + type, isGroupChat, status, style, theme, teamMain, size = 16, }: IRoomTypeIcon) => { if (!type) { return null; @@ -32,7 +33,7 @@ const RoomTypeIcon = React.memo(({ const iconStyle = [ styles.icon, { color }, - style + style, ]; if (type === 'd' && !isGroupChat) { diff --git a/app/containers/SafeAreaView.tsx b/app/containers/SafeAreaView.tsx index c0e536f2e..6a2047fb4 100644 --- a/app/containers/SafeAreaView.tsx +++ b/app/containers/SafeAreaView.tsx @@ -1,13 +1,14 @@ import React from 'react'; import { StyleSheet } from 'react-native'; import { SafeAreaView as SafeAreaContext } from 'react-native-safe-area-context'; + import { themes } from '../constants/colors'; import { withTheme } from '../theme'; const styles = StyleSheet.create({ view: { - flex: 1 - } + flex: 1, + }, }); interface ISafeAreaView { diff --git a/app/containers/SearchBox.tsx b/app/containers/SearchBox.tsx index 191a01866..2937ca2c6 100644 --- a/app/containers/SearchBox.tsx +++ b/app/containers/SearchBox.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import Touchable from 'react-native-platform-touchable'; import TextInput from '../presentation/TextInput'; @@ -14,7 +14,7 @@ const styles = StyleSheet.create({ container: { flexDirection: 'row', alignItems: 'center', - flex: 1 + flex: 1, }, searchBox: { alignItems: 'center', @@ -25,7 +25,7 @@ const styles = StyleSheet.create({ margin: 16, marginVertical: 10, paddingHorizontal: 10, - flex: 1 + flex: 1, }, input: { flex: 1, @@ -33,15 +33,15 @@ const styles = StyleSheet.create({ marginLeft: 8, paddingTop: 0, paddingBottom: 0, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, cancel: { - marginRight: 15 + marginRight: 15, }, cancelText: { ...sharedStyles.textRegular, - fontSize: 17 - } + fontSize: 17, + }, }); interface ISearchBox { @@ -66,14 +66,14 @@ const SearchBox = ({ ); const mapStateToProps = (state: any, ownProps: any) => ({ - status: state.meteor.connected ? (state.activeUsers[ownProps.id] && state.activeUsers[ownProps.id].status) : 'loading' + status: state.meteor.connected ? state.activeUsers[ownProps.id] && state.activeUsers[ownProps.id].status : 'loading', }); export default connect(mapStateToProps)(StatusContainer); diff --git a/app/containers/TextInput.tsx b/app/containers/TextInput.tsx index 7773fb423..17e64fd05 100644 --- a/app/containers/TextInput.tsx +++ b/app/containers/TextInput.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import { BorderlessButton } from 'react-native-gesture-handler'; import sharedStyles from '../views/Styles'; @@ -11,15 +11,15 @@ import ActivityIndicator from './ActivityIndicator'; const styles = StyleSheet.create({ error: { ...sharedStyles.textAlignCenter, - paddingTop: 5 + paddingTop: 5, }, inputContainer: { - marginBottom: 10 + marginBottom: 10, }, label: { marginBottom: 10, fontSize: 14, - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, input: { ...sharedStyles.textRegular, @@ -27,27 +27,27 @@ const styles = StyleSheet.create({ fontSize: 16, paddingHorizontal: 14, borderWidth: StyleSheet.hairlineWidth, - borderRadius: 2 + borderRadius: 2, }, inputIconLeft: { - paddingLeft: 45 + paddingLeft: 45, }, inputIconRight: { - paddingRight: 45 + paddingRight: 45, }, wrap: { - position: 'relative' + position: 'relative', }, iconContainer: { position: 'absolute', - top: 14 + top: 14, }, iconLeft: { - left: 15 + left: 15, }, iconRight: { - right: 15 - } + right: 15, + }, }); interface IRCTextInputProps { @@ -71,14 +71,13 @@ interface IRCTextInputProps { } export default class RCTextInput extends React.PureComponent { - static defaultProps = { error: {}, - theme: 'light' + theme: 'light', } state = { - showPassword: false + showPassword: false, } get iconLeft() { @@ -147,7 +146,7 @@ export default class RCTextInput extends React.PureComponent {label} @@ -155,7 +154,7 @@ export default class RCTextInput extends React.PureComponent { let { tcount } = item; if (tcount >= 1000) { diff --git a/app/containers/Toast.tsx b/app/containers/Toast.tsx index 9a380b8da..89099c5ad 100644 --- a/app/containers/Toast.tsx +++ b/app/containers/Toast.tsx @@ -10,13 +10,13 @@ import { withTheme } from '../theme'; const styles = StyleSheet.create({ toast: { maxWidth: 300, - padding: 10 + padding: 10, }, text: { fontSize: 14, ...sharedStyles.textRegular, - ...sharedStyles.textAlignCenter - } + ...sharedStyles.textAlignCenter, + }, }); export const LISTENER = 'Toast'; @@ -27,6 +27,7 @@ interface IToastProps { class Toast extends React.Component { private listener: any; + private toast: any; componentDidMount() { diff --git a/app/containers/TwoFactor/index.tsx b/app/containers/TwoFactor/index.tsx index 9221b2ace..1ff56b602 100644 --- a/app/containers/TwoFactor/index.tsx +++ b/app/containers/TwoFactor/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { View, Text, InteractionManager } from 'react-native'; +import { InteractionManager, Text, View } from 'react-native'; import isEmpty from 'lodash/isEmpty'; import { sha256 } from 'js-sha256'; import Modal from 'react-native-modal'; @@ -26,18 +26,18 @@ interface ITwoFactor { const methods: any = { totp: { text: 'Open_your_authentication_app_and_enter_the_code', - keyboardType: 'numeric' + keyboardType: 'numeric', }, email: { text: 'Verify_your_email_for_the_code_we_sent', - keyboardType: 'numeric' + keyboardType: 'numeric', }, password: { title: 'Please_enter_your_password', text: 'For_your_security_you_must_enter_your_current_password_to_continue', secureTextEntry: true, - keyboardType: 'default' - } + keyboardType: 'default', + }, }; const TwoFactor = React.memo(({ theme, isMasterDetail }: ITwoFactor) => { @@ -90,7 +90,7 @@ const TwoFactor = React.memo(({ theme, isMasterDetail }: ITwoFactor) => { const color = themes[theme].titleText; return ( { {I18n.t(method?.title || 'Two_Factor_Authentication')} {method?.text ? {I18n.t(method.text)} : null} InteractionManager.runAfterInteractions(() => e?.getNativeRef()?.focus())} @@ -141,7 +141,7 @@ const TwoFactor = React.memo(({ theme, isMasterDetail }: ITwoFactor) => { }); const mapStateToProps = (state: any) => ({ - isMasterDetail: state.app.isMasterDetail + isMasterDetail: state.app.isMasterDetail, }); export default connect(mapStateToProps)(withTheme(TwoFactor)); diff --git a/app/containers/TwoFactor/styles.ts b/app/containers/TwoFactor/styles.ts index 1c5c789cb..8b271943f 100644 --- a/app/containers/TwoFactor/styles.ts +++ b/app/containers/TwoFactor/styles.ts @@ -6,40 +6,40 @@ export default StyleSheet.create({ container: { flex: 1, justifyContent: 'center', - alignItems: 'center' + alignItems: 'center', }, content: { padding: 16, width: '100%', - borderRadius: 4 + borderRadius: 4, }, title: { fontSize: 16, paddingBottom: 8, ...sharedStyles.textBold, - ...sharedStyles.textAlignCenter + ...sharedStyles.textAlignCenter, }, subtitle: { fontSize: 14, paddingBottom: 8, ...sharedStyles.textRegular, - ...sharedStyles.textAlignCenter + ...sharedStyles.textAlignCenter, }, sendEmail: { fontSize: 14, paddingBottom: 24, paddingTop: 8, alignSelf: 'center', - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, button: { - marginBottom: 0 + marginBottom: 0, }, buttonContainer: { flexDirection: 'row', - justifyContent: 'space-between' + justifyContent: 'space-between', }, tablet: { - height: undefined - } + height: undefined, + }, }); diff --git a/app/containers/UIKit/Actions.tsx b/app/containers/UIKit/Actions.tsx index 43f34a4e6..e0a38e382 100644 --- a/app/containers/UIKit/Actions.tsx +++ b/app/containers/UIKit/Actions.tsx @@ -21,7 +21,7 @@ export const Actions = ({ blockId, appId, elements, parser, theme }: IActions) = return ( <> - {/*@ts-ignore*/} + {/* @ts-ignore*/} {showMoreVisible && ( diff --git a/app/containers/message/Message.tsx b/app/containers/message/Message.tsx index fe6cad3f2..36ffc76b0 100644 --- a/app/containers/message/Message.tsx +++ b/app/containers/message/Message.tsx @@ -3,7 +3,6 @@ import { View } from 'react-native'; import Touchable from 'react-native-platform-touchable'; import MessageContext from './Context'; - import User from './User'; import styles from './styles'; import RepliedThread from './RepliedThread'; @@ -19,7 +18,7 @@ import Content from './Content'; import ReadReceipt from './ReadReceipt'; import CallButton from './CallButton'; import { themes } from '../../constants/colors'; -import {IMessage, IMessageInner, IMessageTouchable} from "./interfaces"; +import { IMessage, IMessageInner, IMessageTouchable } from './interfaces'; const MessageInner = React.memo((props: IMessageInner) => { if (props.type === 'discussion-created') { @@ -74,7 +73,7 @@ const Message = React.memo((props: IMessage) => { @@ -91,7 +90,7 @@ const Message = React.memo((props: IMessage) => { diff --git a/app/containers/message/MessageAvatar.tsx b/app/containers/message/MessageAvatar.tsx index f610f1d71..913917c37 100644 --- a/app/containers/message/MessageAvatar.tsx +++ b/app/containers/message/MessageAvatar.tsx @@ -3,16 +3,16 @@ import React, { useContext } from 'react'; import Avatar from '../Avatar'; import styles from './styles'; import MessageContext from './Context'; -import {IMessageAvatar} from "./interfaces"; +import { IMessageAvatar } from './interfaces'; const MessageAvatar = React.memo(({ - isHeader, avatar, author, small, navToRoomInfo, emoji, getCustomEmoji, theme + isHeader, avatar, author, small, navToRoomInfo, emoji, getCustomEmoji, theme, }: IMessageAvatar) => { const { user } = useContext(MessageContext); if (isHeader && author) { const navParam = { t: 'd', - rid: author._id + rid: author._id, }; return ( { ); }); -const Reaction = React.memo(({reaction, getCustomEmoji, theme}: IMessageReaction) => { +const Reaction = React.memo(({ reaction, getCustomEmoji, theme }: IMessageReaction) => { const { onReactionPress, onReactionLongPress, baseUrl, user } = useContext(MessageContext); const reacted = reaction.usernames.findIndex((item: IMessageReaction) => item === user.username) !== -1; return ( diff --git a/app/containers/message/RepliedThread.tsx b/app/containers/message/RepliedThread.tsx index 79e3b6272..7a8a3abaa 100644 --- a/app/containers/message/RepliedThread.tsx +++ b/app/containers/message/RepliedThread.tsx @@ -6,17 +6,17 @@ import styles from './styles'; import { themes } from '../../constants/colors'; import I18n from '../../i18n'; import Markdown from '../markdown'; -import {IMessageRepliedThread} from "./interfaces"; +import { IMessageRepliedThread } from './interfaces'; const RepliedThread = memo(({ - tmid, tmsg, isHeader, fetchThreadName, id, isEncrypted, theme + tmid, tmsg, isHeader, fetchThreadName, id, isEncrypted, theme, }: IMessageRepliedThread) => { if (!tmid || !isHeader) { return null; } const [msg, setMsg] = useState(isEncrypted ? I18n.t('Encrypted_message') : tmsg); - const fetch = async() => { + const fetch = async () => { const threadName = await fetchThreadName(tmid, id); setMsg(threadName); }; @@ -34,7 +34,7 @@ const RepliedThread = memo(({ return ( - {/*@ts-ignore*/} + {/* @ts-ignore*/} - {attachment.fields.map(field => ( + {attachment.fields.map((field) => ( {field.title} - {/*@ts-ignore*/} + {/* @ts-ignore*/} 0 && styles.marginTop, attachment.description && styles.marginBottom, { - backgroundColor, borderColor - } + backgroundColor, borderColor, + }, ]} background={Touchable.Ripple(themes[theme].bannerBackground)} > @@ -242,7 +242,7 @@ const Reply = React.memo(({ attachment, timeFormat, index, getCustomEmoji, theme /> - {/*@ts-ignore*/} + {/* @ts-ignore*/} { if (!tlm || isThreadRoom || tcount === 0) { @@ -14,7 +14,7 @@ const Thread = React.memo(({ msg, tcount, tlm, isThreadRoom, theme, id }: IMessa } const { - threadBadgeColor, toggleFollowThread, user, replies + threadBadgeColor, toggleFollowThread, user, replies, } = useContext(MessageContext); return ( @@ -29,7 +29,7 @@ const Thread = React.memo(({ msg, tcount, tlm, isThreadRoom, theme, id }: IMessa tcount, replies, tlm, - id + id, }} user={user} badgeColor={threadBadgeColor} diff --git a/app/containers/message/Urls.tsx b/app/containers/message/Urls.tsx index 561c1c23c..4591c780b 100644 --- a/app/containers/message/Urls.tsx +++ b/app/containers/message/Urls.tsx @@ -1,5 +1,5 @@ import React, { useContext } from 'react'; -import { View, Text, StyleSheet, Clipboard } from 'react-native'; +import { Clipboard, StyleSheet, Text, View } from 'react-native'; import FastImage from '@rocket.chat/react-native-fast-image'; import { dequal } from 'dequal'; @@ -15,38 +15,38 @@ import MessageContext from './Context'; const styles = StyleSheet.create({ button: { - marginTop: 6 + marginTop: 6, }, container: { flex: 1, flexDirection: 'column', borderRadius: 4, - borderWidth: 1 + borderWidth: 1, }, textContainer: { flex: 1, flexDirection: 'column', padding: 15, justifyContent: 'flex-start', - alignItems: 'flex-start' + alignItems: 'flex-start', }, title: { fontSize: 16, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, description: { fontSize: 16, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, marginTop: { - marginTop: 4 + marginTop: 4, }, image: { width: '100%', height: 150, borderTopLeftRadius: 4, - borderTopRightRadius: 4 - } + borderTopRightRadius: 4, + }, }); interface IMessageUrlContent { @@ -121,8 +121,8 @@ const Url = React.memo(({ url, index, theme }: IMessageUrl) => { styles.container, { backgroundColor: themes[theme].chatComponentBackground, - borderColor: themes[theme].borderColor - } + borderColor: themes[theme].borderColor, + }, ]} background={Touchable.Ripple(themes[theme].bannerBackground)} > diff --git a/app/containers/message/User.tsx b/app/containers/message/User.tsx index 14c86a414..e80cb612f 100644 --- a/app/containers/message/User.tsx +++ b/app/containers/message/User.tsx @@ -1,10 +1,9 @@ import React, { useContext } from 'react'; -import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; +import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import moment from 'moment'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; - import MessageError from './MessageError'; import sharedStyles from '../../views/Styles'; import messageStyles from './styles'; @@ -16,26 +15,26 @@ const styles = StyleSheet.create({ flex: 1, flexDirection: 'row', justifyContent: 'space-between', - alignItems: 'center' + alignItems: 'center', }, username: { fontSize: 16, lineHeight: 22, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, usernameInfoMessage: { fontSize: 16, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, titleContainer: { flexShrink: 1, flexDirection: 'row', - alignItems: 'center' + alignItems: 'center', }, alias: { fontSize: 14, - ...sharedStyles.textRegular - } + ...sharedStyles.textRegular, + }, }); interface IMessageUser { @@ -61,7 +60,7 @@ const User = React.memo(({ if (isHeader || hasError) { const navParam = { t: 'd', - rid: author._id + rid: author._id, }; const { user } = useContext(MessageContext); const username = (useRealName && author.name) || author.username; diff --git a/app/containers/message/Video.tsx b/app/containers/message/Video.tsx index 93a534278..86d74922b 100644 --- a/app/containers/message/Video.tsx +++ b/app/containers/message/Video.tsx @@ -11,7 +11,7 @@ import { formatAttachmentUrl } from '../../lib/utils'; import { themes } from '../../constants/colors'; import MessageContext from './Context'; -const SUPPORTED_TYPES = ['video/quicktime', 'video/mp4', ...(isIOS ? [] : ['video/3gp', 'video/mkv'])]; +const SUPPORTED_TYPES = ['video/quicktime', 'video/mp4', ...isIOS ? [] : ['video/3gp', 'video/mkv']]; const isTypeSupported = (type: any) => SUPPORTED_TYPES.indexOf(type) !== -1; const styles = StyleSheet.create({ @@ -21,8 +21,8 @@ const styles = StyleSheet.create({ height: 150, marginBottom: 6, alignItems: 'center', - justifyContent: 'center' - } + justifyContent: 'center', + }, }); interface IMessageVideo { @@ -62,7 +62,7 @@ const Video = React.memo(({ file, showAttachment, getCustomEmoji, theme }: IMess color={themes[theme].buttonText} /> - {/*@ts-ignore*/} + {/* @ts-ignore*/} ); diff --git a/app/containers/message/index.tsx b/app/containers/message/index.tsx index 8056c3682..d628dfdb4 100644 --- a/app/containers/message/index.tsx +++ b/app/containers/message/index.tsx @@ -63,7 +63,6 @@ interface IMessageContainerProps { } class MessageContainer extends React.Component { - static defaultProps = { getCustomEmoji: () => {}, onLongPress: () => {}, @@ -83,10 +82,11 @@ class MessageContainer extends React.Component { archived: false, broadcast: false, isIgnored: false, - theme: 'light' + theme: 'light', } state = { isManualUnignored: false }; + private subscription: any; componentDidMount() { @@ -102,7 +102,7 @@ class MessageContainer extends React.Component { shouldComponentUpdate(nextProps: any, nextState: any) { const { isManualUnignored } = this.state; const { - theme, threadBadgeColor, isIgnored, highlighted + theme, threadBadgeColor, isIgnored, highlighted, } = this.props; if (nextProps.theme !== theme) { return true; @@ -141,7 +141,7 @@ class MessageContainer extends React.Component { const { item, isThreadRoom } = this.props; Keyboard.dismiss(); - if (((item.tlm || item.tmid) && !isThreadRoom)) { + if ((item.tlm || item.tmid) && !isThreadRoom) { this.onThreadPress(); } }, 300, true); @@ -317,7 +317,7 @@ class MessageContainer extends React.Component { threadBadgeColor, toggleFollowThread, jumpToMessage, - highlighted + highlighted, } = this.props; const { id, @@ -345,7 +345,7 @@ class MessageContainer extends React.Component { unread, blocks, autoTranslate: autoTranslateMessage, - replies + replies, } = item; let message = msg; @@ -373,10 +373,10 @@ class MessageContainer extends React.Component { jumpToMessage, threadBadgeColor, toggleFollowThread, - replies + replies, }} > - {/*@ts-ignore*/} + {/* @ts-ignore*/} ({ root: { - flexDirection: 'row' + flexDirection: 'row', }, container: { paddingVertical: 4, width: '100%', paddingHorizontal: 14, - flexDirection: 'column' + flexDirection: 'column', }, contentContainer: { - flex: 1 + flex: 1, }, messageContent: { flex: 1, - marginLeft: 46 + marginLeft: 46, }, messageContentWithHeader: { - marginLeft: 10 + marginLeft: 10, }, messageContentWithError: { - marginLeft: 0 + marginLeft: 0, }, flex: { - flexDirection: 'row' + flexDirection: 'row', // flex: 1 }, temp: { opacity: 0.3 }, marginTop: { - marginTop: 6 + marginTop: 6, }, reactionsContainer: { flexDirection: 'row', flexWrap: 'wrap', - marginTop: 8 + marginTop: 8, }, reactionButton: { marginRight: 8, marginBottom: 8, - borderRadius: 2 + borderRadius: 2, }, reactionContainer: { flexDirection: 'row', @@ -51,38 +51,38 @@ export default StyleSheet.create({ borderRadius: 2, borderWidth: 1, height: 28, - minWidth: 46.3 + minWidth: 46.3, }, reactionCount: { fontSize: 14, marginLeft: 3, marginRight: 8.5, - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, reactionEmoji: { fontSize: 13, marginLeft: 7, - color: '#ffffff' + color: '#ffffff', }, reactionCustomEmoji: { width: 19, height: 19, - marginLeft: 7 + marginLeft: 7, }, avatar: { - marginTop: 4 + marginTop: 4, }, avatarSmall: { - marginLeft: 16 + marginLeft: 16, }, errorButton: { paddingLeft: 10, - paddingVertical: 5 + paddingVertical: 5, }, buttonContainer: { marginTop: 8, flexDirection: 'row', - alignItems: 'center' + alignItems: 'center', }, button: { paddingHorizontal: 12, @@ -90,19 +90,19 @@ export default StyleSheet.create({ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', - borderRadius: 2 + borderRadius: 2, }, buttonIcon: { - marginRight: 8 + marginRight: 8, }, buttonText: { fontSize: 12, - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, imageContainer: { // flex: 1, flexDirection: 'column', - borderRadius: 4 + borderRadius: 4, }, image: { width: '100%', @@ -110,75 +110,75 @@ export default StyleSheet.create({ minHeight: isTablet ? 300 : 200, borderRadius: 4, borderWidth: 1, - overflow: 'hidden' + overflow: 'hidden', }, imagePressed: { - opacity: 0.5 + opacity: 0.5, }, inlineImage: { width: 300, height: 300, - resizeMode: 'contain' + resizeMode: 'contain', }, text: { fontSize: 16, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, textInfo: { fontStyle: 'italic', fontSize: 16, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, startedDiscussion: { fontStyle: 'italic', fontSize: 16, marginBottom: 6, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, time: { fontSize: 12, marginLeft: 8, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, repliedThread: { flexDirection: 'row', // flex: 1, alignItems: 'center', marginTop: 6, - marginBottom: 12 + marginBottom: 12, }, repliedThreadIcon: { marginRight: 10, - marginLeft: 16 + marginLeft: 16, }, repliedThreadName: { fontSize: 16, flex: 1, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, repliedThreadDisclosure: { marginLeft: 4, marginRight: 4, alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, threadBadge: { width: 8, height: 8, borderRadius: 4, - marginLeft: 8 + marginLeft: 8, }, threadBell: { - marginLeft: 8 + marginLeft: 8, }, readReceipt: { - lineHeight: 20 + lineHeight: 20, }, encrypted: { - justifyContent: 'center' + justifyContent: 'center', }, threadDetails: { flex: 1, - marginLeft: 12 - } + marginLeft: 12, + }, }); diff --git a/app/containers/message/utils.ts b/app/containers/message/utils.ts index e793daf90..d1e9eedc3 100644 --- a/app/containers/message/utils.ts +++ b/app/containers/message/utils.ts @@ -15,7 +15,7 @@ export const formatMessageCount = (count: number, type: string) => { }; export const BUTTON_HIT_SLOP = { - top: 4, right: 4, bottom: 4, left: 4 + top: 4, right: 4, bottom: 4, left: 4, }; export const SYSTEM_MESSAGES = [ @@ -39,7 +39,7 @@ export const SYSTEM_MESSAGES = [ 'message_snippeted', 'thread-created', 'room_e2e_enabled', - 'room_e2e_disabled' + 'room_e2e_disabled', ]; export const SYSTEM_MESSAGE_TYPES = { @@ -48,7 +48,7 @@ export const SYSTEM_MESSAGE_TYPES = { MESSAGE_SNIPPETED: 'message_snippeted', USER_JOINED_CHANNEL: 'uj', USER_JOINED_DISCUSSION: 'ut', - USER_LEFT_CHANNEL: 'ul' + USER_LEFT_CHANNEL: 'ul', }; export const SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME = [ @@ -57,7 +57,7 @@ export const SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME = [ SYSTEM_MESSAGE_TYPES.MESSAGE_SNIPPETED, SYSTEM_MESSAGE_TYPES.USER_JOINED_CHANNEL, SYSTEM_MESSAGE_TYPES.USER_JOINED_DISCUSSION, - SYSTEM_MESSAGE_TYPES.USER_LEFT_CHANNEL + SYSTEM_MESSAGE_TYPES.USER_LEFT_CHANNEL, ]; type TInfoMessage = { @@ -66,49 +66,49 @@ type TInfoMessage = { msg: string; author: { username: string }; } -export const getInfoMessage = ({type, role, msg, author}: TInfoMessage) => { +export const getInfoMessage = ({ type, role, msg, author }: TInfoMessage) => { const { username } = author; if (type === 'rm') { return I18n.t('Message_removed'); - } else if (type === 'uj') { + } if (type === 'uj') { return I18n.t('Has_joined_the_channel'); - } else if (type === 'ut') { + } if (type === 'ut') { return I18n.t('Has_joined_the_conversation'); - } else if (type === 'r') { + } if (type === 'r') { return I18n.t('Room_name_changed', { name: msg, userBy: username }); - } else if (type === 'message_pinned') { + } if (type === 'message_pinned') { return I18n.t('Message_pinned'); - } else if (type === 'jitsi_call_started') { + } if (type === 'jitsi_call_started') { return I18n.t('Started_call', { userBy: username }); - } else if (type === 'ul') { + } if (type === 'ul') { return I18n.t('Has_left_the_channel'); - } else if (type === 'ru') { + } if (type === 'ru') { return I18n.t('User_removed_by', { userRemoved: msg, userBy: username }); - } else if (type === 'au') { + } if (type === 'au') { return I18n.t('User_added_by', { userAdded: msg, userBy: username }); - } else if (type === 'user-muted') { + } if (type === 'user-muted') { return I18n.t('User_muted_by', { userMuted: msg, userBy: username }); - } else if (type === 'user-unmuted') { + } if (type === 'user-unmuted') { return I18n.t('User_unmuted_by', { userUnmuted: msg, userBy: username }); - } else if (type === 'subscription-role-added') { + } if (type === 'subscription-role-added') { return `${ msg } was set ${ role } by ${ username }`; - } else if (type === 'subscription-role-removed') { + } if (type === 'subscription-role-removed') { return `${ msg } is no longer ${ role } by ${ username }`; - } else if (type === 'room_changed_description') { + } if (type === 'room_changed_description') { return I18n.t('Room_changed_description', { description: msg, userBy: username }); - } else if (type === 'room_changed_announcement') { + } if (type === 'room_changed_announcement') { return I18n.t('Room_changed_announcement', { announcement: msg, userBy: username }); - } else if (type === 'room_changed_topic') { + } if (type === 'room_changed_topic') { return I18n.t('Room_changed_topic', { topic: msg, userBy: username }); - } else if (type === 'room_changed_privacy') { + } if (type === 'room_changed_privacy') { return I18n.t('Room_changed_privacy', { type: msg, userBy: username }); - } else if (type === 'room_changed_avatar') { + } if (type === 'room_changed_avatar') { return I18n.t('Room_changed_avatar', { userBy: username }); - } else if (type === 'message_snippeted') { + } if (type === 'message_snippeted') { return I18n.t('Created_snippet'); - } else if (type === 'room_e2e_disabled') { + } if (type === 'room_e2e_disabled') { return I18n.t('This_room_encryption_has_been_disabled_by__username_', { username }); - } else if (type === 'room_e2e_enabled') { + } if (type === 'room_e2e_enabled') { return I18n.t('This_room_encryption_has_been_enabled_by__username_', { username }); } return ''; diff --git a/app/dimensions.tsx b/app/dimensions.tsx index a67cf0479..d8e7a8f54 100644 --- a/app/dimensions.tsx +++ b/app/dimensions.tsx @@ -15,7 +15,7 @@ export const DimensionsContext = React.createContext ( - {contexts => } + {(contexts) => } ); hoistNonReactStatics(DimensionsComponent, Component); @@ -29,6 +29,6 @@ export const useOrientation = () => { const isPortrait = (height)! > (width)!; return { isPortrait, - isLandscape: !isPortrait + isLandscape: !isPortrait, }; }; diff --git a/app/ee/omnichannel/containers/OmnichannelStatus.js b/app/ee/omnichannel/containers/OmnichannelStatus.js index 148f398cf..922561631 100644 --- a/app/ee/omnichannel/containers/OmnichannelStatus.js +++ b/app/ee/omnichannel/containers/OmnichannelStatus.js @@ -1,14 +1,14 @@ -import React, { memo, useState, useEffect } from 'react'; -import { View, Switch } from 'react-native'; +import React, { memo, useEffect, useState } from 'react'; +import { Switch, View } from 'react-native'; import PropTypes from 'prop-types'; import * as List from '../../../containers/List'; import styles from '../../../views/RoomsListView/styles'; -import { themes, SWITCH_TRACK_COLOR } from '../../../constants/colors'; +import { SWITCH_TRACK_COLOR, themes } from '../../../constants/colors'; import { withTheme } from '../../../theme'; import UnreadBadge from '../../../presentation/UnreadBadge'; import RocketChat from '../../../lib/rocketchat'; -import { isOmnichannelStatusAvailable, changeLivechatStatus } from '../lib'; +import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../lib'; const OmnichannelStatus = memo(({ searching, goQueue, theme, queueSize, inquiryEnabled, user diff --git a/app/ee/omnichannel/lib/index.js b/app/ee/omnichannel/lib/index.js index 7492675eb..34159926b 100644 --- a/app/ee/omnichannel/lib/index.js +++ b/app/ee/omnichannel/lib/index.js @@ -1,6 +1,6 @@ -import subscribeInquiry from './subscriptions/inquiry'; import RocketChat from '../../../lib/rocketchat'; import EventEmitter from '../../../utils/events'; +import subscribeInquiry from './subscriptions/inquiry'; export const isOmnichannelStatusAvailable = user => user?.statusLivechat === 'available'; diff --git a/app/ee/omnichannel/lib/subscriptions/inquiry.js b/app/ee/omnichannel/lib/subscriptions/inquiry.js index 02eafb8a9..ef2557cd6 100644 --- a/app/ee/omnichannel/lib/subscriptions/inquiry.js +++ b/app/ee/omnichannel/lib/subscriptions/inquiry.js @@ -2,10 +2,10 @@ import log from '../../../../utils/log'; import store from '../../../../lib/createStore'; import RocketChat from '../../../../lib/rocketchat'; import { - inquiryRequest, inquiryQueueAdd, + inquiryQueueRemove, inquiryQueueUpdate, - inquiryQueueRemove + inquiryRequest } from '../../actions/inquiry'; const removeListener = listener => listener.stop(); diff --git a/app/ee/omnichannel/sagas/inquiry.js b/app/ee/omnichannel/sagas/inquiry.js index 6140e2f65..b9bec6b41 100644 --- a/app/ee/omnichannel/sagas/inquiry.js +++ b/app/ee/omnichannel/sagas/inquiry.js @@ -1,10 +1,10 @@ -import { put, takeLatest, select } from 'redux-saga/effects'; +import { put, select, takeLatest } from 'redux-saga/effects'; import * as types from '../../../actions/actionsTypes'; import RocketChat from '../../../lib/rocketchat'; import EventEmitter from '../../../utils/events'; -import { inquirySuccess, inquiryFailure, inquirySetEnabled } from '../actions/inquiry'; -import { isOmnichannelStatusAvailable, getInquiriesQueued } from '../lib'; +import { inquiryFailure, inquirySetEnabled, inquirySuccess } from '../actions/inquiry'; +import { getInquiriesQueued, isOmnichannelStatusAvailable } from '../lib'; const handleRequest = function* handleRequest() { try { diff --git a/app/ee/omnichannel/views/QueueListView.js b/app/ee/omnichannel/views/QueueListView.js index a261d481e..31c31768f 100644 --- a/app/ee/omnichannel/views/QueueListView.js +++ b/app/ee/omnichannel/views/QueueListView.js @@ -7,7 +7,7 @@ import { dequal } from 'dequal'; import I18n from '../../../i18n'; import RoomItem, { ROW_HEIGHT } from '../../../presentation/RoomItem'; import { MAX_SIDEBAR_WIDTH } from '../../../constants/tablet'; -import { isTablet, isIOS } from '../../../utils/deviceInfo'; +import { isIOS, isTablet } from '../../../utils/deviceInfo'; import { getUserSelector } from '../../../selectors/login'; import { withTheme } from '../../../theme'; import { withDimensions } from '../../../dimensions'; @@ -17,7 +17,7 @@ import StatusBar from '../../../containers/StatusBar'; import { goRoom } from '../../../utils/goRoom'; import * as HeaderButton from '../../../containers/HeaderButton'; import RocketChat from '../../../lib/rocketchat'; -import { logEvent, events } from '../../../utils/log'; +import { events, logEvent } from '../../../utils/log'; import { getInquiryQueueSelector } from '../selectors/inquiry'; const INITIAL_NUM_TO_RENDER = isTablet ? 20 : 12; diff --git a/app/emojis.ts b/app/emojis.ts index 172d15adf..f73a4f79c 100644 --- a/app/emojis.ts +++ b/app/emojis.ts @@ -224,7 +224,7 @@ export const emojisByCategory: any = { 'right_facing_fist', 'handshake', 'fingers_crossed', - 'pregnant_woman' + 'pregnant_woman', ], nature: [ 'dog', @@ -387,7 +387,7 @@ export const emojisByCategory: any = { 'rhino', 'wilted_rose', 'shrimp', - 'squid' + 'squid', ], food: [ 'green_apple', @@ -474,7 +474,7 @@ export const emojisByCategory: any = { 'milk', 'peanuts', 'kiwi', - 'pancakes' + 'pancakes', ], activity: [ 'soccer', @@ -546,7 +546,7 @@ export const emojisByCategory: any = { 'first_place', 'second_place', 'third_place', - 'drum' + 'drum', ], travel: [ 'red_car', @@ -667,7 +667,7 @@ export const emojisByCategory: any = { 'shopping_cart', 'scooter', 'motor_scooter', - 'canoe' + 'canoe', ], objects: [ 'watch', @@ -847,7 +847,7 @@ export const emojisByCategory: any = { 'crayon', 'paintbrush', 'mag', - 'mag_right' + 'mag_right', ], symbols: [ '100', @@ -1160,7 +1160,7 @@ export const emojisByCategory: any = { 'regional_indicator_d', 'regional_indicator_c', 'regional_indicator_b', - 'regional_indicator_a' + 'regional_indicator_a', ], flags: [ 'flag_ac', @@ -1401,8 +1401,8 @@ export const emojisByCategory: any = { 'flag_mp', 'flag_sx', 'flag_ss', - 'flag_tc' - ] + 'flag_tc', + ], }; export const emojis = [ @@ -2811,5 +2811,5 @@ export const emojis = [ 'flag_sx', 'flag_ss', 'flag_tc', - 'flag_mf' + 'flag_mf', ]; diff --git a/app/index.tsx b/app/index.tsx index f1a65267d..c6c50a986 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Linking, Dimensions } from 'react-native'; +import { Dimensions, Linking } from 'react-native'; import { AppearanceProvider } from 'react-native-appearance'; import { Provider } from 'react-redux'; import { KeyCommandsEmitter } from 'react-native-keycommands'; @@ -14,7 +14,7 @@ import { deepLinkingOpen } from './actions/deepLinking'; import parseQuery from './lib/methods/helpers/parseQuery'; import { initializePushNotifications, onNotification } from './notifications/push'; import store from './lib/createStore'; -import { loggerConfig, analytics } from './utils/log'; +import { analytics, loggerConfig } from './utils/log'; import { ThemeContext } from './theme'; import { DimensionsContext } from './dimensions'; import RocketChat, { THEME_PREFERENCES_KEY } from './lib/rocketchat'; @@ -40,7 +40,6 @@ interface IDimensions { fontScale: number } -interface IProps {} interface IState { theme: string, themePreferences: { @@ -74,11 +73,12 @@ const parseDeepLinking = (url: string) => { return null; }; -export default class Root extends React.Component { - private listenerTimeout!: NodeJS.Timeout; +export default class Root extends React.Component<{}, IState> { + private listenerTimeout!: any; + private onKeyCommands: any; - constructor(props: IProps) { + constructor(props: any) { super(props); this.init(); if (!isFDroidBuild) { @@ -89,12 +89,12 @@ export default class Root extends React.Component { theme: defaultTheme(), themePreferences: { currentTheme: supportSystemTheme() ? 'automatic' : 'light', - darkLevel: 'black' + darkLevel: 'black', }, width, height, scale, - fontScale + fontScale, }; if (isTablet) { this.initTablet(); @@ -124,7 +124,7 @@ export default class Root extends React.Component { } } - init = async() => { + init = async () => { UserPreferences.getMapAsync(THEME_PREFERENCES_KEY).then(() => this.setTheme()); store.dispatch(appInitLocalSettings()); @@ -162,26 +162,26 @@ export default class Root extends React.Component { // Dimensions update fires twice onDimensionsChange = debounce(({ window: { - width, height, scale, fontScale - } + width, height, scale, fontScale, + }, }: {window: IDimensions}) => { this.setDimensions({ - width, height, scale, fontScale + width, height, scale, fontScale, }); this.setMasterDetail(width); }) setTheme = (newTheme = {}) => { // change theme state - this.setState(prevState => newThemeState(prevState, newTheme), () => { + this.setState((prevState) => newThemeState(prevState, newTheme), () => { const { themePreferences } = this.state; // subscribe to Appearance changes subscribeTheme(themePreferences, this.setTheme); }); } - setDimensions = ({width, height, scale, fontScale}: IDimensions) => { - this.setState({width, height, scale, fontScale}); + setDimensions = ({ width, height, scale, fontScale }: IDimensions) => { + this.setState({ width, height, scale, fontScale }); } initTablet = () => { @@ -191,7 +191,7 @@ export default class Root extends React.Component { 'onKeyCommand', (command: unknown) => { EventEmitter.emit(KEY_COMMAND, { event: command }); - } + }, ); } @@ -216,7 +216,7 @@ export default class Root extends React.Component { value={{ theme, themePreferences, - setTheme: this.setTheme + setTheme: this.setTheme, }} > { height, scale, fontScale, - setDimensions: this.setDimensions + setDimensions: this.setDimensions, }} > diff --git a/app/lib/Navigation.ts b/app/lib/Navigation.ts index b3bddf9c6..0beb11b31 100644 --- a/app/lib/Navigation.ts +++ b/app/lib/Navigation.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import { CommonActions, StackActions, NavigationContainerRef } from '@react-navigation/native'; +import { CommonActions, NavigationContainerRef, StackActions } from '@react-navigation/native'; const navigationRef = React.createRef(); const routeNameRef: React.MutableRefObject = React.createRef(); @@ -21,5 +21,5 @@ export default { routeNameRef, navigate, back, - replace + replace, }; diff --git a/app/lib/ShareNavigation.ts b/app/lib/ShareNavigation.ts index c0f5a9ad5..413698d00 100644 --- a/app/lib/ShareNavigation.ts +++ b/app/lib/ShareNavigation.ts @@ -7,5 +7,5 @@ const routeNameRef: React.MutableRefObject = Reac export default { navigationRef, - routeNameRef + routeNameRef, }; diff --git a/app/lib/createStore.js b/app/lib/createStore.js index da52de600..6716caabf 100644 --- a/app/lib/createStore.js +++ b/app/lib/createStore.js @@ -1,4 +1,4 @@ -import { createStore, applyMiddleware, compose } from 'redux'; +import { applyMiddleware, compose, createStore } from 'redux'; import createSagaMiddleware from 'redux-saga'; import reducers from '../reducers'; diff --git a/app/lib/database/index.js b/app/lib/database/index.js index 67ae9782c..1000af921 100644 --- a/app/lib/database/index.js +++ b/app/lib/database/index.js @@ -2,6 +2,9 @@ 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 { isOfficial } from '../../constants/environment'; import Subscription from './model/Subscription'; import Room from './model/Room'; import Message from './model/Message'; @@ -15,21 +18,14 @@ import Role from './model/Role'; import Permission from './model/Permission'; import SlashCommand from './model/SlashCommand'; import User from './model/User'; - import LoggedUser from './model/servers/User'; import Server from './model/servers/Server'; import ServersHistory from './model/ServersHistory'; - import serversSchema from './schema/servers'; import appSchema from './schema/app'; - import migrations from './model/migrations'; import serversMigrations from './model/servers/migrations'; -import { isIOS } from '../../utils/deviceInfo'; -import appGroup from '../../utils/appGroup'; -import { isOfficial } from '../../constants/environment'; - const appGroupPath = isIOS ? appGroup.path : ''; if (__DEV__ && isIOS) { diff --git a/app/lib/database/model/CustomEmoji.js b/app/lib/database/model/CustomEmoji.js index fdf5d2063..9f3e1b6a8 100644 --- a/app/lib/database/model/CustomEmoji.js +++ b/app/lib/database/model/CustomEmoji.js @@ -1,5 +1,5 @@ import { Model } from '@nozbe/watermelondb'; -import { field, date, json } from '@nozbe/watermelondb/decorators'; +import { date, field, json } from '@nozbe/watermelondb/decorators'; import { sanitizer } from '../utils'; diff --git a/app/lib/database/model/Message.js b/app/lib/database/model/Message.js index 52cf63f0c..643bbc95d 100644 --- a/app/lib/database/model/Message.js +++ b/app/lib/database/model/Message.js @@ -1,6 +1,6 @@ import { Model } from '@nozbe/watermelondb'; import { - field, relation, date, json + date, field, json, relation } from '@nozbe/watermelondb/decorators'; import { sanitizer } from '../utils'; diff --git a/app/lib/database/model/Permission.js b/app/lib/database/model/Permission.js index 8771de4dc..5923f83dc 100644 --- a/app/lib/database/model/Permission.js +++ b/app/lib/database/model/Permission.js @@ -1,5 +1,5 @@ import { Model } from '@nozbe/watermelondb'; -import { json, date } from '@nozbe/watermelondb/decorators'; +import { date, json } from '@nozbe/watermelondb/decorators'; import { sanitizer } from '../utils'; diff --git a/app/lib/database/model/ServersHistory.js b/app/lib/database/model/ServersHistory.js index 469775f13..7b1191080 100644 --- a/app/lib/database/model/ServersHistory.js +++ b/app/lib/database/model/ServersHistory.js @@ -1,5 +1,5 @@ import { Model } from '@nozbe/watermelondb'; -import { field, date, readonly } from '@nozbe/watermelondb/decorators'; +import { date, field, readonly } from '@nozbe/watermelondb/decorators'; export default class ServersHistory extends Model { static table = 'servers_history'; diff --git a/app/lib/database/model/Setting.js b/app/lib/database/model/Setting.js index 050e70981..753d965ba 100644 --- a/app/lib/database/model/Setting.js +++ b/app/lib/database/model/Setting.js @@ -1,5 +1,5 @@ import { Model } from '@nozbe/watermelondb'; -import { field, date, json } from '@nozbe/watermelondb/decorators'; +import { date, field, json } from '@nozbe/watermelondb/decorators'; import { sanitizer } from '../utils'; diff --git a/app/lib/database/model/Subscription.js b/app/lib/database/model/Subscription.js index 275dae217..c636bea3d 100644 --- a/app/lib/database/model/Subscription.js +++ b/app/lib/database/model/Subscription.js @@ -1,7 +1,8 @@ import { Model } from '@nozbe/watermelondb'; import { - field, date, json, children + children, date, field, json } from '@nozbe/watermelondb/decorators'; + import { sanitizer } from '../utils'; export const TABLE_NAME = 'subscriptions'; diff --git a/app/lib/database/model/Thread.js b/app/lib/database/model/Thread.js index 04e658392..1760b19db 100644 --- a/app/lib/database/model/Thread.js +++ b/app/lib/database/model/Thread.js @@ -1,6 +1,6 @@ import { Model } from '@nozbe/watermelondb'; import { - field, relation, date, json + date, field, json, relation } from '@nozbe/watermelondb/decorators'; import { sanitizer } from '../utils'; diff --git a/app/lib/database/model/ThreadMessage.js b/app/lib/database/model/ThreadMessage.js index 687e09f96..c8e0de631 100644 --- a/app/lib/database/model/ThreadMessage.js +++ b/app/lib/database/model/ThreadMessage.js @@ -1,6 +1,6 @@ import { Model } from '@nozbe/watermelondb'; import { - field, relation, date, json + date, field, json, relation } from '@nozbe/watermelondb/decorators'; import { sanitizer } from '../utils'; diff --git a/app/lib/database/model/migrations.js b/app/lib/database/model/migrations.js index cdc65ef0f..c58651f04 100644 --- a/app/lib/database/model/migrations.js +++ b/app/lib/database/model/migrations.js @@ -1,4 +1,4 @@ -import { schemaMigrations, addColumns, createTable } from '@nozbe/watermelondb/Schema/migrations'; +import { addColumns, createTable, schemaMigrations } from '@nozbe/watermelondb/Schema/migrations'; export default schemaMigrations({ migrations: [ diff --git a/app/lib/database/model/servers/Server.js b/app/lib/database/model/servers/Server.js index df770a32e..0bff69ffe 100644 --- a/app/lib/database/model/servers/Server.js +++ b/app/lib/database/model/servers/Server.js @@ -1,5 +1,5 @@ import { Model } from '@nozbe/watermelondb'; -import { field, date } from '@nozbe/watermelondb/decorators'; +import { date, field } from '@nozbe/watermelondb/decorators'; export default class Server extends Model { static table = 'servers'; diff --git a/app/lib/database/model/servers/migrations.js b/app/lib/database/model/servers/migrations.js index 80954d475..64a72cb03 100644 --- a/app/lib/database/model/servers/migrations.js +++ b/app/lib/database/model/servers/migrations.js @@ -1,4 +1,4 @@ -import { schemaMigrations, addColumns, createTable } from '@nozbe/watermelondb/Schema/migrations'; +import { addColumns, createTable, schemaMigrations } from '@nozbe/watermelondb/Schema/migrations'; export default schemaMigrations({ migrations: [ diff --git a/app/lib/encryption/encryption.js b/app/lib/encryption/encryption.js index e4a7f2c14..3d6a38ba9 100644 --- a/app/lib/encryption/encryption.js +++ b/app/lib/encryption/encryption.js @@ -3,29 +3,29 @@ import SimpleCrypto from 'react-native-simple-crypto'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { Q } from '@nozbe/watermelondb'; -import { - toString, - utf8ToBuffer, - splitVectorData, - joinVectorData, - randomPassword -} from './utils'; -import { - E2E_PUBLIC_KEY, - E2E_PRIVATE_KEY, - E2E_RANDOM_PASSWORD_KEY, - E2E_STATUS, - E2E_MESSAGE_TYPE, - E2E_BANNER_TYPE -} from './constants'; import RocketChat from '../rocketchat'; -import { EncryptionRoom } from './index'; import UserPreferences from '../userPreferences'; import database from '../database'; import protectedFunction from '../methods/helpers/protectedFunction'; import Deferred from '../../utils/deferred'; import log from '../../utils/log'; import store from '../createStore'; +import { + E2E_BANNER_TYPE, + E2E_MESSAGE_TYPE, + E2E_PRIVATE_KEY, + E2E_PUBLIC_KEY, + E2E_RANDOM_PASSWORD_KEY, + E2E_STATUS +} from './constants'; +import { + joinVectorData, + randomPassword, + splitVectorData, + toString, + utf8ToBuffer +} from './utils'; +import { EncryptionRoom } from './index'; class Encryption { constructor() { @@ -292,12 +292,12 @@ class Encryption { // If we select only encrypted rooms we can miss some room that changed their encrypted status const subsEncrypted = await subCollection.query(Q.where('e2e_key_id', Q.notEq(null))).fetch(); // We can't do this on database level since lastMessage is not a database object - const subsToDecrypt = subsEncrypted.filter(sub => ( + const subsToDecrypt = subsEncrypted.filter(sub => // Encrypted message sub?.lastMessage?.t === E2E_MESSAGE_TYPE // Message pending decrypt && sub?.lastMessage?.e2e === E2E_STATUS.PENDING - )); + ); await Promise.all(subsToDecrypt.map(async(sub) => { const { rid, lastMessage } = sub; const newSub = await this.decryptSubscription({ rid, lastMessage }); diff --git a/app/lib/encryption/room.js b/app/lib/encryption/room.js index 0aa1b932e..b5d678aee 100644 --- a/app/lib/encryption/room.js +++ b/app/lib/encryption/room.js @@ -2,23 +2,23 @@ import EJSON from 'ejson'; import { Base64 } from 'js-base64'; import SimpleCrypto from 'react-native-simple-crypto'; -import { - toString, - b64ToBuffer, - bufferToUtf8, - bufferToB64, - bufferToB64URI, - utf8ToBuffer, - splitVectorData, - joinVectorData -} from './utils'; -import { E2E_MESSAGE_TYPE, E2E_STATUS } from './constants'; import RocketChat from '../rocketchat'; import Deferred from '../../utils/deferred'; import debounce from '../../utils/debounce'; -import { Encryption } from './index'; import database from '../database'; import log from '../../utils/log'; +import { E2E_MESSAGE_TYPE, E2E_STATUS } from './constants'; +import { + b64ToBuffer, + bufferToB64, + bufferToB64URI, + bufferToUtf8, + joinVectorData, + splitVectorData, + toString, + utf8ToBuffer +} from './utils'; +import { Encryption } from './index'; export default class EncryptionRoom { constructor(roomId, userId) { diff --git a/app/lib/methods/callJitsi.js b/app/lib/methods/callJitsi.js index 7275ef812..2be98de8e 100644 --- a/app/lib/methods/callJitsi.js +++ b/app/lib/methods/callJitsi.js @@ -1,6 +1,6 @@ import reduxStore from '../createStore'; import Navigation from '../Navigation'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; async function jitsiURL({ room }) { const { settings } = reduxStore.getState(); diff --git a/app/lib/methods/enterpriseModules.js b/app/lib/methods/enterpriseModules.js index d86ae26fd..01b7c9300 100644 --- a/app/lib/methods/enterpriseModules.js +++ b/app/lib/methods/enterpriseModules.js @@ -1,9 +1,8 @@ import { compareServerVersion, methods } from '../utils'; - import reduxStore from '../createStore'; import database from '../database'; import log from '../../utils/log'; -import { setEnterpriseModules as setEnterpriseModulesAction, clearEnterpriseModules } from '../../actions/enterpriseModules'; +import { clearEnterpriseModules, setEnterpriseModules as setEnterpriseModulesAction } from '../../actions/enterpriseModules'; export const LICENSE_OMNICHANNEL_MOBILE_ENTERPRISE = 'omnichannel-mobile-enterprise'; export const LICENSE_LIVECHAT_ENTERPRISE = 'livechat-enterprise'; diff --git a/app/lib/methods/getPermissions.js b/app/lib/methods/getPermissions.js index 1c4c56b46..8954a07ae 100644 --- a/app/lib/methods/getPermissions.js +++ b/app/lib/methods/getPermissions.js @@ -7,8 +7,8 @@ import database from '../database'; import log from '../../utils/log'; import reduxStore from '../createStore'; import RocketChat from '../rocketchat'; -import protectedFunction from './helpers/protectedFunction'; import { setPermissions as setPermissionsAction } from '../../actions/permissions'; +import protectedFunction from './helpers/protectedFunction'; const PERMISSIONS = [ 'add-user-to-any-c-room', diff --git a/app/lib/methods/getRoles.js b/app/lib/methods/getRoles.js index 98a3895e3..5e60f1e8a 100644 --- a/app/lib/methods/getRoles.js +++ b/app/lib/methods/getRoles.js @@ -3,10 +3,10 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import database from '../database'; import log from '../../utils/log'; import reduxStore from '../createStore'; -import protectedFunction from './helpers/protectedFunction'; import { removeRoles, setRoles as setRolesAction, updateRoles } from '../../actions/roles'; +import protectedFunction from './helpers/protectedFunction'; export async function setRoles() { const db = database.active; diff --git a/app/lib/methods/getSettings.js b/app/lib/methods/getSettings.js index be6ef1ee3..c43e2f1dc 100644 --- a/app/lib/methods/getSettings.js +++ b/app/lib/methods/getSettings.js @@ -7,9 +7,9 @@ import reduxStore from '../createStore'; import settings from '../../constants/settings'; import log from '../../utils/log'; import database from '../database'; -import protectedFunction from './helpers/protectedFunction'; import fetch from '../../utils/fetch'; import { DEFAULT_AUTO_LOCK } from '../../constants/localAuthentication'; +import protectedFunction from './helpers/protectedFunction'; const serverInfoKeys = [ 'Site_Name', diff --git a/app/lib/methods/getThreadName.js b/app/lib/methods/getThreadName.js index 1eb1fbc78..861fb521f 100644 --- a/app/lib/methods/getThreadName.js +++ b/app/lib/methods/getThreadName.js @@ -4,8 +4,8 @@ import database from '../database'; import { getMessageById } from '../database/services/Message'; import { getThreadById } from '../database/services/Thread'; import log from '../../utils/log'; -import getSingleMessage from './getSingleMessage'; import { Encryption } from '../encryption'; +import getSingleMessage from './getSingleMessage'; const buildThreadName = thread => thread.msg || thread?.attachments?.[0]?.title; diff --git a/app/lib/methods/helpers/buildMessage.js b/app/lib/methods/helpers/buildMessage.js index a565046fa..9868ef13e 100644 --- a/app/lib/methods/helpers/buildMessage.js +++ b/app/lib/methods/helpers/buildMessage.js @@ -1,5 +1,5 @@ -import normalizeMessage from './normalizeMessage'; import messagesStatus from '../../../constants/messagesStatus'; +import normalizeMessage from './normalizeMessage'; export default (message) => { message.status = messagesStatus.SENT; diff --git a/app/lib/methods/helpers/mergeSubscriptionsRooms.js b/app/lib/methods/helpers/mergeSubscriptionsRooms.js index 82dfc4c68..2d4d3c0f7 100644 --- a/app/lib/methods/helpers/mergeSubscriptionsRooms.js +++ b/app/lib/methods/helpers/mergeSubscriptionsRooms.js @@ -1,10 +1,10 @@ import EJSON from 'ejson'; -import normalizeMessage from './normalizeMessage'; -import findSubscriptionsRooms from './findSubscriptionsRooms'; import { Encryption } from '../../encryption'; import reduxStore from '../../createStore'; import { compareServerVersion, methods } from '../../utils'; +import findSubscriptionsRooms from './findSubscriptionsRooms'; +import normalizeMessage from './normalizeMessage'; // TODO: delete and update export const merge = (subscription, room) => { diff --git a/app/lib/methods/loadMessagesForRoom.js b/app/lib/methods/loadMessagesForRoom.js index a8dc733ac..5ef75c7b6 100644 --- a/app/lib/methods/loadMessagesForRoom.js +++ b/app/lib/methods/loadMessagesForRoom.js @@ -3,8 +3,8 @@ import moment from 'moment'; import { MESSAGE_TYPE_LOAD_MORE } from '../../constants/messageTypeLoad'; import log from '../../utils/log'; import { getMessageById } from '../database/services/Message'; -import updateMessages from './updateMessages'; import { generateLoadMoreId } from '../utils'; +import updateMessages from './updateMessages'; const COUNT = 50; diff --git a/app/lib/methods/loadMissedMessages.js b/app/lib/methods/loadMissedMessages.js index d1acaf0b4..f6cf13fa9 100644 --- a/app/lib/methods/loadMissedMessages.js +++ b/app/lib/methods/loadMissedMessages.js @@ -29,7 +29,7 @@ async function load({ rid: roomId, lastOpen }) { export default function loadMissedMessages(args) { return new Promise(async(resolve, reject) => { try { - const data = (await load.call(this, { rid: args.rid, lastOpen: args.lastOpen })); + const data = await load.call(this, { rid: args.rid, lastOpen: args.lastOpen }); if (data) { const { updated, deleted } = data; diff --git a/app/lib/methods/loadNextMessages.js b/app/lib/methods/loadNextMessages.js index 3a5e5e6ff..48dae4c39 100644 --- a/app/lib/methods/loadNextMessages.js +++ b/app/lib/methods/loadNextMessages.js @@ -3,10 +3,10 @@ import moment from 'moment'; import orderBy from 'lodash/orderBy'; import log from '../../utils/log'; -import updateMessages from './updateMessages'; import { getMessageById } from '../database/services/Message'; import { MESSAGE_TYPE_LOAD_NEXT_CHUNK } from '../../constants/messageTypeLoad'; import { generateLoadMoreId } from '../utils'; +import updateMessages from './updateMessages'; const COUNT = 50; diff --git a/app/lib/methods/loadSurroundingMessages.js b/app/lib/methods/loadSurroundingMessages.js index 74c345c2f..5c46ad2f1 100644 --- a/app/lib/methods/loadSurroundingMessages.js +++ b/app/lib/methods/loadSurroundingMessages.js @@ -3,10 +3,10 @@ import moment from 'moment'; import orderBy from 'lodash/orderBy'; import log from '../../utils/log'; -import updateMessages from './updateMessages'; import { getMessageById } from '../database/services/Message'; import { MESSAGE_TYPE_LOAD_NEXT_CHUNK, MESSAGE_TYPE_LOAD_PREVIOUS_CHUNK } from '../../constants/messageTypeLoad'; import { generateLoadMoreId } from '../utils'; +import updateMessages from './updateMessages'; const COUNT = 50; diff --git a/app/lib/methods/loadThreadMessages.js b/app/lib/methods/loadThreadMessages.js index d170635e8..d86d8e908 100644 --- a/app/lib/methods/loadThreadMessages.js +++ b/app/lib/methods/loadThreadMessages.js @@ -2,11 +2,11 @@ import { Q } from '@nozbe/watermelondb'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import EJSON from 'ejson'; -import buildMessage from './helpers/buildMessage'; import database from '../database'; import log from '../../utils/log'; -import protectedFunction from './helpers/protectedFunction'; import { Encryption } from '../encryption'; +import protectedFunction from './helpers/protectedFunction'; +import buildMessage from './helpers/buildMessage'; async function load({ tmid }) { try { diff --git a/app/lib/methods/logout.js b/app/lib/methods/logout.js index 114b76207..33e8c8818 100644 --- a/app/lib/methods/logout.js +++ b/app/lib/methods/logout.js @@ -8,8 +8,8 @@ import database, { getDatabase } from '../database'; import RocketChat from '../rocketchat'; import { useSsl } from '../../utils/url'; import { - E2E_PUBLIC_KEY, E2E_PRIVATE_KEY, + E2E_PUBLIC_KEY, E2E_RANDOM_PASSWORD_KEY } from '../encryption/constants'; import UserPreferences from '../userPreferences'; diff --git a/app/lib/methods/subscriptions/room.js b/app/lib/methods/subscriptions/room.js index 2d9ba8f90..7e21a7293 100644 --- a/app/lib/methods/subscriptions/room.js +++ b/app/lib/methods/subscriptions/room.js @@ -7,7 +7,7 @@ import protectedFunction from '../helpers/protectedFunction'; import buildMessage from '../helpers/buildMessage'; import database from '../../database'; import reduxStore from '../../createStore'; -import { addUserTyping, removeUserTyping, clearUserTyping } from '../../../actions/usersTyping'; +import { addUserTyping, clearUserTyping, removeUserTyping } from '../../../actions/usersTyping'; import debounce from '../../../utils/debounce'; import RocketChat from '../../rocketchat'; import { subscribeRoom, unsubscribeRoom } from '../../../actions/room'; @@ -156,7 +156,7 @@ export default class RoomSubscription { RocketChat.readMessages(this.rid, lastOpen); }, 300); - updateMessage = message => ( + updateMessage = message => new Promise(async(resolve) => { if (this.rid !== message.rid) { return resolve(); @@ -234,7 +234,7 @@ export default class RoomSubscription { return resolve(); }) - ) + handleMessageReceived = (ddpMessage) => { if (!this.timer) { diff --git a/app/lib/methods/updateMessages.js b/app/lib/methods/updateMessages.js index 0b6b6c7c0..8130e9179 100644 --- a/app/lib/methods/updateMessages.js +++ b/app/lib/methods/updateMessages.js @@ -1,13 +1,13 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { Q } from '@nozbe/watermelondb'; -import buildMessage from './helpers/buildMessage'; import log from '../../utils/log'; import database from '../database'; -import protectedFunction from './helpers/protectedFunction'; import { Encryption } from '../encryption'; import { MESSAGE_TYPE_ANY_LOAD } from '../../constants/messageTypeLoad'; import { generateLoadMoreId } from '../utils'; +import protectedFunction from './helpers/protectedFunction'; +import buildMessage from './helpers/buildMessage'; export default function updateMessages({ rid, update = [], remove = [], loaderItem diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 59ee94fc5..a01790f44 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -1,71 +1,63 @@ import { InteractionManager } from 'react-native'; import EJSON from 'ejson'; import { - Rocketchat as RocketchatClient, - settings as RocketChatSettings + settings as RocketChatSettings, + Rocketchat as RocketchatClient } from '@rocket.chat/sdk'; import { Q } from '@nozbe/watermelondb'; import AsyncStorage from '@react-native-community/async-storage'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import RNFetchBlob from 'rn-fetch-blob'; -import { compareServerVersion, methods } from './utils'; -import reduxStore from './createStore'; import defaultSettings from '../constants/settings'; -import database from './database'; import log from '../utils/log'; -import { isIOS, getBundleId } from '../utils/deviceInfo'; +import { getBundleId, isIOS } from '../utils/deviceInfo'; import fetch from '../utils/fetch'; import SSLPinning from '../utils/sslPinning'; - import { encryptionInit } from '../actions/encryption'; -import { setUser, setLoginServices, loginRequest } from '../actions/login'; -import { disconnect, connectSuccess, connectRequest } from '../actions/connect'; -import { shareSelectServer, shareSetUser, shareSetSettings } from '../actions/share'; - -import subscribeRooms from './methods/subscriptions/rooms'; -import getUsersPresence, { getUserPresence, subscribeUsersPresence } from './methods/getUsersPresence'; - -import protectedFunction from './methods/helpers/protectedFunction'; -import readMessages from './methods/readMessages'; -import getSettings, { getLoginSettings, setSettings, subscribeSettings } from './methods/getSettings'; - -import getRooms from './methods/getRooms'; -import { setPermissions, getPermissions } from './methods/getPermissions'; -import { getCustomEmojis, setCustomEmojis } from './methods/getCustomEmojis'; -import { - getEnterpriseModules, setEnterpriseModules, hasLicense, isOmnichannelModuleAvailable -} from './methods/enterpriseModules'; -import getSlashCommands from './methods/getSlashCommands'; -import { getRoles, setRoles, onRolesChanged } from './methods/getRoles'; -import canOpenRoom from './methods/canOpenRoom'; -import triggerBlockAction, { triggerSubmitView, triggerCancel } from './methods/actions'; - -import loadMessagesForRoom from './methods/loadMessagesForRoom'; -import loadSurroundingMessages from './methods/loadSurroundingMessages'; -import loadNextMessages from './methods/loadNextMessages'; -import loadMissedMessages from './methods/loadMissedMessages'; -import loadThreadMessages from './methods/loadThreadMessages'; - -import sendMessage, { resendMessage } from './methods/sendMessage'; -import { sendFileMessage, cancelUpload, isUploadActive } from './methods/sendFileMessage'; - -import callJitsi from './methods/callJitsi'; -import logout, { removeServer } from './methods/logout'; - +import { loginRequest, setLoginServices, setUser } from '../actions/login'; +import { connectRequest, connectSuccess, disconnect } from '../actions/connect'; +import { shareSelectServer, shareSetSettings, shareSetUser } from '../actions/share'; import { getDeviceToken } from '../notifications/push'; import { setActiveUsers } from '../actions/activeUsers'; import I18n from '../i18n'; import { twoFactor } from '../utils/twoFactor'; import { selectServerFailure } from '../actions/server'; import { useSsl } from '../utils/url'; -import UserPreferences from './userPreferences'; -import { Encryption } from './encryption'; import EventEmitter from '../utils/events'; -import { sanitizeLikeString } from './database/utils'; import { updatePermission } from '../actions/permissions'; import { TEAM_TYPE } from '../definition/ITeam'; import { updateSettings } from '../actions/settings'; +import { compareServerVersion, methods } from './utils'; +import reduxStore from './createStore'; +import database from './database'; +import subscribeRooms from './methods/subscriptions/rooms'; +import getUsersPresence, { getUserPresence, subscribeUsersPresence } from './methods/getUsersPresence'; +import protectedFunction from './methods/helpers/protectedFunction'; +import readMessages from './methods/readMessages'; +import getSettings, { getLoginSettings, setSettings, subscribeSettings } from './methods/getSettings'; +import getRooms from './methods/getRooms'; +import { getPermissions, setPermissions } from './methods/getPermissions'; +import { getCustomEmojis, setCustomEmojis } from './methods/getCustomEmojis'; +import { + getEnterpriseModules, hasLicense, isOmnichannelModuleAvailable, setEnterpriseModules +} from './methods/enterpriseModules'; +import getSlashCommands from './methods/getSlashCommands'; +import { getRoles, onRolesChanged, setRoles } from './methods/getRoles'; +import canOpenRoom from './methods/canOpenRoom'; +import triggerBlockAction, { triggerCancel, triggerSubmitView } from './methods/actions'; +import loadMessagesForRoom from './methods/loadMessagesForRoom'; +import loadSurroundingMessages from './methods/loadSurroundingMessages'; +import loadNextMessages from './methods/loadNextMessages'; +import loadMissedMessages from './methods/loadMissedMessages'; +import loadThreadMessages from './methods/loadThreadMessages'; +import sendMessage, { resendMessage } from './methods/sendMessage'; +import { cancelUpload, isUploadActive, sendFileMessage } from './methods/sendFileMessage'; +import callJitsi from './methods/callJitsi'; +import logout, { removeServer } from './methods/logout'; +import UserPreferences from './userPreferences'; +import { Encryption } from './encryption'; +import { sanitizeLikeString } from './database/utils'; const TOKEN_KEY = 'reactnativemeteor_usertoken'; const CURRENT_SERVER = 'currentServer'; @@ -109,7 +101,7 @@ const RocketChat = { extraData: { broadcast, encrypted, - ...(teamId && { teamId }) + ...teamId && { teamId } } }; return this.post(type ? 'groups.create' : 'channels.create', params); @@ -140,7 +132,7 @@ const RocketChat = { try { // Try to resolve as json const jsonRes = response.json(); - if (!(jsonRes?.success)) { + if (!jsonRes?.success) { return { success: false, message: I18n.t('Not_RC_Server', { contact: I18n.t('Contact_your_server_admin') }) @@ -713,7 +705,7 @@ const RocketChat = { t: sub.t, encrypted: sub.encrypted, lastMessage: sub.lastMessage, - ...(sub.teamId && { teamId: sub.teamId }) + ...sub.teamId && { teamId: sub.teamId } })); return data; @@ -854,7 +846,7 @@ const RocketChat = { }, convertChannelToTeam({ rid, name, type }) { const params = { - ...(type === 'c' + ...type === 'c' ? { channelId: rid, channelName: name @@ -862,14 +854,14 @@ const RocketChat = { : { roomId: rid, roomName: name - }) + } }; return this.sdk.post(type === 'c' ? 'channels.convertToTeam' : 'groups.convertToTeam', params); }, convertTeamToChannel({ teamId, selected }) { const params = { teamId, - ...(selected.length && { roomsToRemove: selected }) + ...selected.length && { roomsToRemove: selected } }; return this.sdk.post('teams.convertToChannel', params); }, @@ -1606,7 +1598,7 @@ const RocketChat = { return false; } const autoTranslatePermission = reduxStore.getState().permissions['auto-translate']; - const userRoles = (reduxStore.getState().login?.user?.roles) ?? []; + const userRoles = reduxStore.getState().login?.user?.roles ?? []; return autoTranslatePermission?.some(role => userRoles.includes(role)); } catch (e) { log(e); diff --git a/app/lib/utils.js b/app/lib/utils.js index 615b353ae..ec7a398ee 100644 --- a/app/lib/utils.js +++ b/app/lib/utils.js @@ -1,5 +1,5 @@ import { - lt, lte, gt, gte, coerce + coerce, gt, gte, lt, lte } from 'semver'; export const formatAttachmentUrl = (attachmentUrl, userId, token, server) => { diff --git a/app/notifications/push/index.js b/app/notifications/push/index.js index 13e929164..8e6db991a 100644 --- a/app/notifications/push/index.js +++ b/app/notifications/push/index.js @@ -1,8 +1,9 @@ import EJSON from 'ejson'; -import PushNotification from './push'; + import store from '../../lib/createStore'; import { deepLinkingOpen } from '../../actions/deepLinking'; import { isFDroidBuild } from '../../constants/environment'; +import PushNotification from './push'; export const onNotification = (notification) => { if (notification) { diff --git a/app/presentation/DirectoryItem/index.tsx b/app/presentation/DirectoryItem/index.tsx index 400eb42e6..6e07bc454 100644 --- a/app/presentation/DirectoryItem/index.tsx +++ b/app/presentation/DirectoryItem/index.tsx @@ -36,7 +36,7 @@ const DirectoryItemLabel = React.memo(({ text, theme }: IDirectoryItemLabel) => }); const DirectoryItem = ({ - title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme, teamMain + title, description, avatar, onPress, testID, style, rightLabel, type, rid, theme, teamMain, }: IDirectoryItem) => ( { - render() { const { imageComponentType }: any = this.props; @@ -284,11 +284,17 @@ interface IImageViewerProps { export class ImageViewer extends React.Component { private _onPinchEvent: any; + private _focalDisplacementX: any; + private _focalDisplacementY: any; + private _scale: any; + private _onPanEvent: any; + private _panTransX: any; + private _panTransY: any; constructor(props: IImageViewerProps) { @@ -310,9 +316,9 @@ export class ImageViewer extends React.Component { state: pinchState, scale: pinchScale, focalX: pinchFocalX, - focalY: pinchFocalY - } - } + focalY: pinchFocalY, + }, + }, ]); // SCALE @@ -321,12 +327,12 @@ export class ImageViewer extends React.Component { this._focalDisplacementX = new Value(0); const relativeFocalX = sub( pinchFocalX, - add(panTransX, this._focalDisplacementX) + add(panTransX, this._focalDisplacementX), ); this._focalDisplacementY = new Value(0); const relativeFocalY = sub( pinchFocalY, - add(panTransY, this._focalDisplacementY) + add(panTransY, this._focalDisplacementY), ); this._scale = set( scale, @@ -337,8 +343,8 @@ export class ImageViewer extends React.Component { relativeFocalX, this._focalDisplacementX, relativeFocalY, - this._focalDisplacementY - ) + this._focalDisplacementY, + ), ); // PAN @@ -350,9 +356,9 @@ export class ImageViewer extends React.Component { nativeEvent: { translationX: dragX, translationY: dragY, - state: panState - } - } + state: panState, + }, + }, ]); const panActive = eq(panState, State.ACTIVE); @@ -362,7 +368,7 @@ export class ImageViewer extends React.Component { const panUpX = cond( lessThan(this._scale, 1), 0, - multiply(-1, this._focalDisplacementX) + multiply(-1, this._focalDisplacementX), ); const panLowX = add(panUpX, multiply(-WIDTH, add(max(1, this._scale), -1))); this._panTransX = set( @@ -373,19 +379,19 @@ export class ImageViewer extends React.Component { or(panActive, pinchActive), panLowX, panUpX, - panFriction - ) + panFriction, + ), ); // Y const panUpY = cond( lessThan(this._scale, 1), 0, - multiply(-1, this._focalDisplacementY) + multiply(-1, this._focalDisplacementY), ); const panLowY = add( panUpY, - multiply(-HEIGHT, add(max(1, this._scale), -1)) + multiply(-HEIGHT, add(max(1, this._scale), -1)), ); this._panTransY = set( panTransY, @@ -395,8 +401,8 @@ export class ImageViewer extends React.Component { or(panActive, pinchActive), panLowY, panUpY, - panFriction - ) + panFriction, + ), ); } @@ -438,7 +444,7 @@ export class ImageViewer extends React.Component { styles.image, { width, - height: '100%' + height: '100%', }, { transform: [ @@ -448,9 +454,9 @@ export class ImageViewer extends React.Component { { translateY: this._focalDisplacementY }, { translateX: scaleTopLeftFixX }, { translateY: scaleTopLeftFixY }, - { scale: this._scale } - ] - } + { scale: this._scale }, + ], + }, ]} imageComponentType={imageComponentType} resizeMode='contain' diff --git a/app/presentation/ImageViewer/ImageViewer.ios.tsx b/app/presentation/ImageViewer/ImageViewer.ios.tsx index 2dc51049e..f3eafeea9 100644 --- a/app/presentation/ImageViewer/ImageViewer.ios.tsx +++ b/app/presentation/ImageViewer/ImageViewer.ios.tsx @@ -7,11 +7,11 @@ import { themes } from '../../constants/colors'; const styles = StyleSheet.create({ scrollContent: { width: '100%', - height: '100%' + height: '100%', }, image: { - flex: 1 - } + flex: 1, + }, }); interface IImageViewer { @@ -34,7 +34,7 @@ export const ImageViewer = ({ contentContainerStyle={[ styles.scrollContent, width && { width }, - height && { height } + height && { height }, ]} showsHorizontalScrollIndicator={false} showsVerticalScrollIndicator={false} diff --git a/app/presentation/ImageViewer/index.ts b/app/presentation/ImageViewer/index.ts index bf629ae84..d8ae350b5 100644 --- a/app/presentation/ImageViewer/index.ts +++ b/app/presentation/ImageViewer/index.ts @@ -1,3 +1,5 @@ +// @ts-ignore +// eslint-disable-next-line import/no-unresolved export * from './ImageViewer'; export * from './types'; export * from './ImageComponent'; diff --git a/app/presentation/ImageViewer/types.ts b/app/presentation/ImageViewer/types.ts index 56c4a7d27..6af8284b9 100644 --- a/app/presentation/ImageViewer/types.ts +++ b/app/presentation/ImageViewer/types.ts @@ -1,4 +1,4 @@ export const types = { FAST_IMAGE: 'FAST_IMAGE', - REACT_NATIVE_IMAGE: 'REACT_NATIVE' + REACT_NATIVE_IMAGE: 'REACT_NATIVE', }; diff --git a/app/presentation/KeyboardView.tsx b/app/presentation/KeyboardView.tsx index 0cc5b5e56..0214ab662 100644 --- a/app/presentation/KeyboardView.tsx +++ b/app/presentation/KeyboardView.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { KeyboardAwareScrollView } from '@codler/react-native-keyboard-aware-scroll-view'; + import scrollPersistTaps from '../utils/scrollPersistTaps'; interface IKeyboardViewProps { @@ -11,10 +12,9 @@ interface IKeyboardViewProps { } export default class KeyboardView extends React.PureComponent { - render() { const { - style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children + style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children, } = this.props; return ( diff --git a/app/presentation/RoomItem/Actions.tsx b/app/presentation/RoomItem/Actions.tsx index b87299d5c..9569d1ab1 100644 --- a/app/presentation/RoomItem/Actions.tsx +++ b/app/presentation/RoomItem/Actions.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Animated, View, Text } from 'react-native'; +import { Animated, Text, View } from 'react-native'; import { RectButton } from 'react-native-gesture-handler'; import I18n, { isRTL } from '../../i18n'; @@ -27,14 +27,14 @@ interface IRightActions { const reverse = new Animated.Value(isRTL() ? -1 : 1); export const LeftActions = React.memo(({ - theme, transX, isRead, width, onToggleReadPress + theme, transX, isRead, width, onToggleReadPress, }: ILeftActions) => { const translateX = Animated.multiply( transX.interpolate({ inputRange: [0, ACTION_WIDTH], - outputRange: [-ACTION_WIDTH, 0] + outputRange: [-ACTION_WIDTH, 0], }), - reverse + reverse, ); return ( @@ -66,21 +66,21 @@ export const LeftActions = React.memo(({ }); export const RightActions = React.memo(({ - transX, favorite, width, toggleFav, onHidePress, theme + transX, favorite, width, toggleFav, onHidePress, theme, }: IRightActions) => { const translateXFav = Animated.multiply( transX.interpolate({ inputRange: [-width / 2, -ACTION_WIDTH * 2, 0], - outputRange: [width / 2, width - ACTION_WIDTH * 2, width] + outputRange: [width / 2, width - ACTION_WIDTH * 2, width], }), - reverse + reverse, ); const translateXHide = Animated.multiply( transX.interpolate({ inputRange: [-width, -LONG_SWIPE, -ACTION_WIDTH * 2, 0], - outputRange: [0, width - LONG_SWIPE, width - ACTION_WIDTH, width] + outputRange: [0, width - LONG_SWIPE, width - ACTION_WIDTH, width], }), - reverse + reverse, ); return ( @@ -99,8 +99,8 @@ export const RightActions = React.memo(({ { width, transform: [{ translateX: translateXFav }], - backgroundColor: themes[theme].hideBackground - } + backgroundColor: themes[theme].hideBackground, + }, ]} > @@ -115,8 +115,8 @@ export const RightActions = React.memo(({ styles.actionRightButtonContainer, { width, - transform: [{ translateX: translateXHide }] - } + transform: [{ translateX: translateXHide }], + }, ]} > diff --git a/app/presentation/RoomItem/LastMessage.tsx b/app/presentation/RoomItem/LastMessage.tsx index 62bd881a1..186d72ca4 100644 --- a/app/presentation/RoomItem/LastMessage.tsx +++ b/app/presentation/RoomItem/LastMessage.tsx @@ -26,7 +26,7 @@ interface ILastMessage { } const formatMsg = ({ - lastMessage, type, showLastMessage, username, useRealName + lastMessage, type, showLastMessage, username, useRealName, }: Partial) => { if (!showLastMessage) { return ''; @@ -65,12 +65,12 @@ const formatMsg = ({ const arePropsEqual = (oldProps: any, newProps: any) => dequal(oldProps, newProps); const LastMessage = React.memo(({ - lastMessage, type, showLastMessage, username, alert, useRealName, theme + lastMessage, type, showLastMessage, username, alert, useRealName, theme, }: ILastMessage) => ( // @ts-ignore ( { ( style={[ styles.title, alert && !hideUnreadStatus && styles.alert, - { color: themes[theme].titleText } + { color: themes[theme].titleText }, ]} ellipsizeMode='tail' numberOfLines={1} diff --git a/app/presentation/RoomItem/Touchable.tsx b/app/presentation/RoomItem/Touchable.tsx index 8161ac4c2..246256dd8 100644 --- a/app/presentation/RoomItem/Touchable.tsx +++ b/app/presentation/RoomItem/Touchable.tsx @@ -1,14 +1,14 @@ import React from 'react'; import { Animated } from 'react-native'; import { - LongPressGestureHandler, PanGestureHandler, State + LongPressGestureHandler, PanGestureHandler, State, } from 'react-native-gesture-handler'; import Touch from '../../utils/touch'; import { ACTION_WIDTH, + LONG_SWIPE, SMALL_SWIPE, - LONG_SWIPE } from './styles'; import { isRTL } from '../../i18n'; import { themes } from '../../constants/colors'; @@ -34,11 +34,17 @@ interface ITouchableProps { class Touchable extends React.Component { private dragX: Animated.Value; + private rowOffSet: Animated.Value; + private reverse: Animated.Value; + private transX: Animated.AnimatedAddition; + private transXReverse: Animated.AnimatedMultiplication; + private _onGestureEvent: (...args: any[]) => void; + private _value: number; constructor(props: ITouchableProps) { @@ -48,243 +54,243 @@ class Touchable extends React.Component { this.reverse = new Animated.Value(isRTL() ? -1 : 1); this.transX = Animated.add( this.rowOffSet, - this.dragX + this.dragX, ); this.transXReverse = Animated.multiply( this.transX, - this.reverse + this.reverse, ); this.state = { - rowState: 0 // 0: closed, 1: right opened, -1: left opened + rowState: 0, // 0: closed, 1: right opened, -1: left opened }; this._onGestureEvent = Animated.event( - [{ nativeEvent: { translationX: this.dragX } }], { useNativeDriver: true } + [{ nativeEvent: { translationX: this.dragX } }], { useNativeDriver: true }, ); this._value = 0; } - _onHandlerStateChange = ({ nativeEvent }: any) => { - if (nativeEvent.oldState === State.ACTIVE) { - this._handleRelease(nativeEvent); - } + _onHandlerStateChange = ({ nativeEvent }: any) => { + if (nativeEvent.oldState === State.ACTIVE) { + this._handleRelease(nativeEvent); } + } - onLongPressHandlerStateChange = ({ nativeEvent }: any) => { - if (nativeEvent.state === State.ACTIVE) { - this.onLongPress(); - } + onLongPressHandlerStateChange = ({ nativeEvent }: any) => { + if (nativeEvent.state === State.ACTIVE) { + this.onLongPress(); } + } - _handleRelease = (nativeEvent: any) => { - const { translationX } = nativeEvent; - const { rowState } = this.state; - this._value += translationX; + _handleRelease = (nativeEvent: any) => { + const { translationX } = nativeEvent; + const { rowState } = this.state; + this._value += translationX; - let toValue = 0; - if (rowState === 0) { // if no option is opened - if (translationX > 0 && translationX < LONG_SWIPE) { - // open leading option if he swipe right but not enough to trigger action - if (isRTL()) { - toValue = 2 * ACTION_WIDTH; - } else { - toValue = ACTION_WIDTH; - } - this.setState({ rowState: -1 }); - } else if (translationX >= LONG_SWIPE) { - toValue = 0; - if (isRTL()) { - this.hideChannel(); - } else { - this.toggleRead(); - } - } else if (translationX < 0 && translationX > -LONG_SWIPE) { - // open trailing option if he swipe left - if (isRTL()) { - toValue = -ACTION_WIDTH; - } else { - toValue = -2 * ACTION_WIDTH; - } - this.setState({ rowState: 1 }); - } else if (translationX <= -LONG_SWIPE) { - toValue = 0; - this.setState({ rowState: 0 }); - if (isRTL()) { - this.toggleRead(); - } else { - this.hideChannel(); - } - } else { - toValue = 0; - } - } - - if (rowState === -1) { // if left option is opened - if (this._value < SMALL_SWIPE) { - toValue = 0; - this.setState({ rowState: 0 }); - } else if (this._value > LONG_SWIPE) { - toValue = 0; - this.setState({ rowState: 0 }); - if (isRTL()) { - this.hideChannel(); - } else { - this.toggleRead(); - } - } else if (isRTL()) { + let toValue = 0; + if (rowState === 0) { // if no option is opened + if (translationX > 0 && translationX < LONG_SWIPE) { + // open leading option if he swipe right but not enough to trigger action + if (isRTL()) { toValue = 2 * ACTION_WIDTH; } else { toValue = ACTION_WIDTH; } - } - - if (rowState === 1) { // if right option is opened - if (this._value > -2 * SMALL_SWIPE) { - toValue = 0; - this.setState({ rowState: 0 }); - } else if (this._value < -LONG_SWIPE) { - toValue = 0; - this.setState({ rowState: 0 }); - if (isRTL()) { - this.toggleRead(); - } else { - this.hideChannel(); - } - } else if (isRTL()) { + this.setState({ rowState: -1 }); + } else if (translationX >= LONG_SWIPE) { + toValue = 0; + if (isRTL()) { + this.hideChannel(); + } else { + this.toggleRead(); + } + } else if (translationX < 0 && translationX > -LONG_SWIPE) { + // open trailing option if he swipe left + if (isRTL()) { toValue = -ACTION_WIDTH; } else { toValue = -2 * ACTION_WIDTH; } + this.setState({ rowState: 1 }); + } else if (translationX <= -LONG_SWIPE) { + toValue = 0; + this.setState({ rowState: 0 }); + if (isRTL()) { + this.toggleRead(); + } else { + this.hideChannel(); + } + } else { + toValue = 0; } - this._animateRow(toValue); } - _animateRow = (toValue: any) => { - this.rowOffSet.setValue(this._value); - this._value = toValue; - this.dragX.setValue(0); - Animated.spring(this.rowOffSet, { - toValue, - bounciness: 0, - useNativeDriver: true - }).start(); + if (rowState === -1) { // if left option is opened + if (this._value < SMALL_SWIPE) { + toValue = 0; + this.setState({ rowState: 0 }); + } else if (this._value > LONG_SWIPE) { + toValue = 0; + this.setState({ rowState: 0 }); + if (isRTL()) { + this.hideChannel(); + } else { + this.toggleRead(); + } + } else if (isRTL()) { + toValue = 2 * ACTION_WIDTH; + } else { + toValue = ACTION_WIDTH; + } } - close = () => { - this.setState({ rowState: 0 }); - this._animateRow(0); + if (rowState === 1) { // if right option is opened + if (this._value > -2 * SMALL_SWIPE) { + toValue = 0; + this.setState({ rowState: 0 }); + } else if (this._value < -LONG_SWIPE) { + toValue = 0; + this.setState({ rowState: 0 }); + if (isRTL()) { + this.toggleRead(); + } else { + this.hideChannel(); + } + } else if (isRTL()) { + toValue = -ACTION_WIDTH; + } else { + toValue = -2 * ACTION_WIDTH; + } + } + this._animateRow(toValue); + } + + _animateRow = (toValue: any) => { + this.rowOffSet.setValue(this._value); + this._value = toValue; + this.dragX.setValue(0); + Animated.spring(this.rowOffSet, { + toValue, + bounciness: 0, + useNativeDriver: true, + }).start(); + } + + close = () => { + this.setState({ rowState: 0 }); + this._animateRow(0); + } + + toggleFav = () => { + const { toggleFav, rid, favorite } = this.props; + if (toggleFav) { + toggleFav(rid, favorite); + } + this.close(); + }; + + toggleRead = () => { + const { toggleRead, rid, isRead } = this.props; + if (toggleRead) { + toggleRead(rid, isRead); + } + }; + + hideChannel = () => { + const { hideChannel, rid, type } = this.props; + if (hideChannel) { + hideChannel(rid, type); + } + }; + + onToggleReadPress = () => { + this.toggleRead(); + this.close(); + }; + + onHidePress = () => { + this.hideChannel(); + this.close(); + }; + + onPress = () => { + const { rowState } = this.state; + if (rowState !== 0) { + this.close(); + return; + } + const { onPress } = this.props; + if (onPress) { + onPress(); + } + }; + + onLongPress = () => { + const { rowState } = this.state; + const { onLongPress } = this.props; + if (rowState !== 0) { + this.close(); + return; } - toggleFav = () => { - const { toggleFav, rid, favorite } = this.props; - if (toggleFav) { - toggleFav(rid, favorite); - } - this.close(); - }; + if (onLongPress) { + onLongPress(); + } + }; - toggleRead = () => { - const { toggleRead, rid, isRead } = this.props; - if (toggleRead) { - toggleRead(rid, isRead); - } - }; + render() { + const { + testID, isRead, width, favorite, children, theme, isFocused, swipeEnabled, + } = this.props; - hideChannel = () => { - const { hideChannel, rid, type } = this.props; - if (hideChannel) { - hideChannel(rid, type); - } - }; - - onToggleReadPress = () => { - this.toggleRead(); - this.close(); - }; - - onHidePress = () => { - this.hideChannel(); - this.close(); - }; - - onPress = () => { - const { rowState } = this.state; - if (rowState !== 0) { - this.close(); - return; - } - const { onPress } = this.props; - if (onPress) { - onPress(); - } - }; - - onLongPress = () => { - const { rowState } = this.state; - const { onLongPress } = this.props; - if (rowState !== 0) { - this.close(); - return; - } - - if (onLongPress) { - onLongPress(); - } - }; - - render() { - const { - testID, isRead, width, favorite, children, theme, isFocused, swipeEnabled - } = this.props; - - return ( - - - - - + + + + + + + - - - - {children} - - + {children} + + - - - - ); - } + + + + ); + } } export default Touchable; diff --git a/app/presentation/RoomItem/TypeIcon.tsx b/app/presentation/RoomItem/TypeIcon.tsx index 3f1bc4194..1e9dff188 100644 --- a/app/presentation/RoomItem/TypeIcon.tsx +++ b/app/presentation/RoomItem/TypeIcon.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import RoomTypeIcon from '../../containers/RoomTypeIcon'; interface ITypeIcon { @@ -11,7 +12,7 @@ interface ITypeIcon { } const TypeIcon = React.memo(({ - type, prid, status, isGroupChat, teamMain + type, prid, status, isGroupChat, teamMain, }: ITypeIcon) => ); export default TypeIcon; diff --git a/app/presentation/RoomItem/UpdatedAt.tsx b/app/presentation/RoomItem/UpdatedAt.tsx index 092709c7d..8e08f8bcb 100644 --- a/app/presentation/RoomItem/UpdatedAt.tsx +++ b/app/presentation/RoomItem/UpdatedAt.tsx @@ -23,16 +23,16 @@ const UpdatedAt = React.memo(({ date, theme, hideUnreadStatus, alert }: IUpdated { color: themes[theme] - .auxiliaryText + .auxiliaryText, }, alert && !hideUnreadStatus && [ styles.updateAlert, { color: themes[theme] - .tintColor - } - ] + .tintColor, + }, + ], ]} ellipsizeMode='tail' numberOfLines={1} diff --git a/app/presentation/RoomItem/Wrapper.tsx b/app/presentation/RoomItem/Wrapper.tsx index 6e7459b8e..3ce868631 100644 --- a/app/presentation/RoomItem/Wrapper.tsx +++ b/app/presentation/RoomItem/Wrapper.tsx @@ -22,7 +22,7 @@ const Wrapper = ({ type, theme, rid, - children + children, }: IWrapper) => ( {children} diff --git a/app/presentation/RoomItem/index.tsx b/app/presentation/RoomItem/index.tsx index 3393fca6b..3cad44055 100644 --- a/app/presentation/RoomItem/index.tsx +++ b/app/presentation/RoomItem/index.tsx @@ -12,8 +12,8 @@ interface IRoomItemContainerProps { item: any; showLastMessage: boolean; id: string; - onPress({}?): void; - onLongPress({}?): void; + onPress: Function; + onLongPress: Function; username: string; avatarSize: number; width: number; @@ -42,11 +42,12 @@ const attrs = [ 'isFocused', 'forceUpdate', 'showLastMessage', - 'autoJoin' + 'autoJoin', ]; class RoomItemContainer extends React.Component { private mounted: boolean; + private roomSubscription: any; static defaultProps = { @@ -57,7 +58,7 @@ class RoomItemContainer extends React.Component { getRoomAvatar: () => '', getIsGroupChat: () => false, getIsRead: () => false, - swipeEnabled: true + swipeEnabled: true, } constructor(props: IRoomItemContainerProps) { @@ -76,7 +77,7 @@ class RoomItemContainer extends React.Component { shouldComponentUpdate(nextProps: any) { const { props }: any = this; - return !attrs.every(key => props[key] === nextProps[key]); + return !attrs.every((key) => props[key] === nextProps[key]); } componentDidUpdate(prevProps: any) { @@ -142,14 +143,14 @@ class RoomItemContainer extends React.Component { username, useRealName, swipeEnabled, - autoJoin + autoJoin, } = this.props; const name = getRoomTitle(item); const testID = `rooms-list-view-item-${ name }`; const avatar = getRoomAvatar(item); const isRead = getIsRead(item); const date = item.roomUpdatedAt && formatDate(item.roomUpdatedAt); - const alert = (item.alert || item.tunread?.length); + const alert = item.alert || item.tunread?.length; let accessibilityLabel = name; if (item.unread === 1) { @@ -222,7 +223,7 @@ const mapStateToProps = (state: any, ownProps: any) => { } return { connected: state.meteor.connected, - status + status, }; }; diff --git a/app/presentation/RoomItem/styles.ts b/app/presentation/RoomItem/styles.ts index f6c5bf05f..6e9fe7558 100644 --- a/app/presentation/RoomItem/styles.ts +++ b/app/presentation/RoomItem/styles.ts @@ -1,4 +1,4 @@ -import { StyleSheet, PixelRatio } from 'react-native'; +import { PixelRatio, StyleSheet } from 'react-native'; import sharedStyles from '../../views/Styles'; @@ -9,103 +9,103 @@ export const LONG_SWIPE = ACTION_WIDTH * 3; export default StyleSheet.create({ flex: { - flex: 1 + flex: 1, }, container: { flexDirection: 'row', alignItems: 'center', paddingLeft: 14, - height: ROW_HEIGHT + height: ROW_HEIGHT, }, centerContainer: { flex: 1, paddingVertical: 10, paddingRight: 14, - borderBottomWidth: StyleSheet.hairlineWidth + borderBottomWidth: StyleSheet.hairlineWidth, }, title: { flex: 1, fontSize: 17, lineHeight: 20, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, alert: { - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, row: { flex: 1, flexDirection: 'row', - alignItems: 'flex-start' + alignItems: 'flex-start', }, titleContainer: { width: '100%', flexDirection: 'row', alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, date: { fontSize: 13, marginLeft: 4, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, updateAlert: { - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, status: { - marginRight: 2 + marginRight: 2, }, markdownText: { flex: 1, fontSize: 14, lineHeight: 17, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, avatar: { - marginRight: 10 + marginRight: 10, }, upperContainer: { - overflow: 'hidden' + overflow: 'hidden', }, actionsContainer: { position: 'absolute', left: 0, right: 0, - height: ROW_HEIGHT + height: ROW_HEIGHT, }, actionText: { fontSize: 15, justifyContent: 'center', marginTop: 4, - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, actionLeftButtonContainer: { position: 'absolute', height: ROW_HEIGHT, justifyContent: 'center', top: 0, - right: 0 + right: 0, }, actionRightButtonContainer: { position: 'absolute', height: ROW_HEIGHT, justifyContent: 'center', - top: 0 + top: 0, }, actionButton: { width: ACTION_WIDTH, height: '100%', alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, tagContainer: { alignSelf: 'center', alignItems: 'center', borderRadius: 4, - marginHorizontal: 4 + marginHorizontal: 4, }, tagText: { fontSize: 13, paddingHorizontal: 4, - ...sharedStyles.textSemibold - } + ...sharedStyles.textSemibold, + }, }); diff --git a/app/presentation/ServerItem/index.tsx b/app/presentation/ServerItem/index.tsx index e5fbbcb88..07192994f 100644 --- a/app/presentation/ServerItem/index.tsx +++ b/app/presentation/ServerItem/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; // @ts-ignore -import { View, Text, Pressable } from 'react-native'; +import { Pressable, Text, View } from 'react-native'; import FastImage from '@rocket.chat/react-native-fast-image'; import Check from '../../containers/Check'; @@ -26,19 +26,19 @@ interface IServerItem { const defaultLogo = require('../../static/images/logo.png'); const ServerItem = React.memo(({ - item, onPress, onLongPress, hasCheck, theme + item, onPress, onLongPress, hasCheck, theme, }: IServerItem) => ( onLongPress?.()} testID={`rooms-list-header-server-${ item.id }`} android_ripple={{ - color: themes[theme].bannerBackground + color: themes[theme].bannerBackground, }} style={({ pressed }: any) => ({ backgroundColor: isIOS && pressed ? themes[theme].bannerBackground - : themes[theme].backgroundColor + : themes[theme].backgroundColor, })} > @@ -47,7 +47,7 @@ const ServerItem = React.memo(({ { - if ((!unread || unread <= 0) && (!tunread?.length)) { + if ((!unread || unread <= 0) && !tunread?.length) { return {}; } @@ -18,6 +18,6 @@ export const getUnreadStyle = ({ } return { - backgroundColor, color + backgroundColor, color, }; }; diff --git a/app/presentation/UnreadBadge/index.tsx b/app/presentation/UnreadBadge/index.tsx index f5865dbb3..6b47d511e 100644 --- a/app/presentation/UnreadBadge/index.tsx +++ b/app/presentation/UnreadBadge/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import sharedStyles from '../../views/Styles'; import { getUnreadStyle } from './getUnreadStyle'; @@ -13,20 +13,20 @@ const styles = StyleSheet.create({ borderRadius: 10.5, alignItems: 'center', justifyContent: 'center', - marginLeft: 10 + marginLeft: 10, }, unreadNumberContainerSmall: { borderRadius: 10.5, alignItems: 'center', - justifyContent: 'center' + justifyContent: 'center', }, unreadText: { fontSize: 13, - ...sharedStyles.textSemibold + ...sharedStyles.textSemibold, }, textSmall: { - fontSize: 10 - } + fontSize: 10, + }, }); interface IUnreadBadge { @@ -42,13 +42,13 @@ interface IUnreadBadge { } const UnreadBadge = React.memo(({ - theme, unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small + theme, unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small, }: IUnreadBadge) => { - if ((!unread || unread <= 0) && (!tunread?.length)) { + if ((!unread || unread <= 0) && !tunread?.length) { return null; } const { backgroundColor, color } = getUnreadStyle({ - theme, unread, userMentions, groupMentions, tunread, tunreadUser, tunreadGroup + theme, unread, userMentions, groupMentions, tunread, tunreadUser, tunreadGroup, }); if (!backgroundColor) { @@ -73,14 +73,14 @@ const UnreadBadge = React.memo(({ style={[ small ? styles.unreadNumberContainerSmall : styles.unreadNumberContainerNormal, { backgroundColor, minWidth }, - style + style, ]} > {text} diff --git a/app/presentation/UserItem.tsx b/app/presentation/UserItem.tsx index 4a718a5e6..c12b36034 100644 --- a/app/presentation/UserItem.tsx +++ b/app/presentation/UserItem.tsx @@ -1,6 +1,6 @@ import React from 'react'; // @ts-ignore -import { Text, View, StyleSheet, Pressable } from 'react-native'; +import { Pressable, StyleSheet, Text, View } from 'react-native'; import Avatar from '../containers/Avatar'; import { CustomIcon } from '../lib/Icons'; @@ -10,33 +10,33 @@ import { isIOS } from '../utils/deviceInfo'; const styles = StyleSheet.create({ button: { - height: 54 + height: 54, }, container: { - flexDirection: 'row' + flexDirection: 'row', }, avatar: { marginHorizontal: 15, - marginVertical: 12 + marginVertical: 12, }, textContainer: { flex: 1, flexDirection: 'column', justifyContent: 'center', - marginRight: 15 + marginRight: 15, }, name: { fontSize: 17, - ...sharedStyles.textMedium + ...sharedStyles.textMedium, }, username: { fontSize: 14, - ...sharedStyles.textRegular + ...sharedStyles.textRegular, }, icon: { marginHorizontal: 15, - alignSelf: 'center' - } + alignSelf: 'center', + }, }); interface IUserItem { @@ -51,19 +51,19 @@ interface IUserItem { } const UserItem = ({ - name, username, onPress, testID, onLongPress, style, icon, theme + name, username, onPress, testID, onLongPress, style, icon, theme, }: IUserItem) => ( ({ backgroundColor: isIOS && pressed ? themes[theme].bannerBackground - : 'transparent' + : 'transparent', })} > diff --git a/app/reducers/crashReport.js b/app/reducers/crashReport.js index 8465897e3..38efaaee2 100644 --- a/app/reducers/crashReport.js +++ b/app/reducers/crashReport.js @@ -1,4 +1,4 @@ -import { TOGGLE_CRASH_REPORT, TOGGLE_ANALYTICS_EVENTS } from '../actions/actionsTypes'; +import { TOGGLE_ANALYTICS_EVENTS, TOGGLE_CRASH_REPORT } from '../actions/actionsTypes'; const initialState = { allowCrashReport: false, diff --git a/app/reducers/index.js b/app/reducers/index.js index eb8f09d82..85213196b 100644 --- a/app/reducers/index.js +++ b/app/reducers/index.js @@ -1,4 +1,6 @@ import { combineReducers } from 'redux'; + +import inquiry from '../ee/omnichannel/reducers/inquiry'; import settings from './settings'; import login from './login'; import meteor from './connect'; @@ -21,8 +23,6 @@ import encryption from './encryption'; import permissions from './permissions'; import roles from './roles'; -import inquiry from '../ee/omnichannel/reducers/inquiry'; - export default combineReducers({ settings, login, diff --git a/app/sagas/createChannel.js b/app/sagas/createChannel.js index 9493d5405..6f1b41219 100644 --- a/app/sagas/createChannel.js +++ b/app/sagas/createChannel.js @@ -1,16 +1,16 @@ import { - select, put, call, take, takeLatest + call, put, select, take, takeLatest } from 'redux-saga/effects'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { CREATE_CHANNEL, LOGIN } from '../actions/actionsTypes'; -import { createChannelSuccess, createChannelFailure } from '../actions/createChannel'; +import { createChannelFailure, createChannelSuccess } from '../actions/createChannel'; import { showErrorAlert } from '../utils/info'; import RocketChat from '../lib/rocketchat'; import Navigation from '../lib/Navigation'; import database from '../lib/database'; import I18n from '../i18n'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; import { goRoom } from '../utils/goRoom'; const createChannel = function createChannel(data) { diff --git a/app/sagas/createDiscussion.js b/app/sagas/createDiscussion.js index 746ab1583..ddbc32f9f 100644 --- a/app/sagas/createDiscussion.js +++ b/app/sagas/createDiscussion.js @@ -1,13 +1,13 @@ import { - select, put, call, take, takeLatest + call, put, select, take, takeLatest } from 'redux-saga/effects'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { CREATE_DISCUSSION, LOGIN } from '../actions/actionsTypes'; -import { createDiscussionSuccess, createDiscussionFailure } from '../actions/createDiscussion'; +import { createDiscussionFailure, createDiscussionSuccess } from '../actions/createDiscussion'; import RocketChat from '../lib/rocketchat'; import database from '../lib/database'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; const create = function* create(data) { return yield RocketChat.createDiscussion(data); diff --git a/app/sagas/deepLinking.js b/app/sagas/deepLinking.js index a406f56a9..b577163ea 100644 --- a/app/sagas/deepLinking.js +++ b/app/sagas/deepLinking.js @@ -1,17 +1,17 @@ import { - takeLatest, take, select, put, all, delay + all, delay, put, select, take, takeLatest } from 'redux-saga/effects'; import UserPreferences from '../lib/userPreferences'; import Navigation from '../lib/Navigation'; import * as types from '../actions/actionsTypes'; import { selectServerRequest, serverInitAdd } from '../actions/server'; -import { inviteLinksSetToken, inviteLinksRequest } from '../actions/inviteLinks'; +import { inviteLinksRequest, inviteLinksSetToken } from '../actions/inviteLinks'; import database from '../lib/database'; import RocketChat from '../lib/rocketchat'; import EventEmitter from '../utils/events'; import { - appStart, ROOT_INSIDE, ROOT_NEW_SERVER, appInit + ROOT_INSIDE, ROOT_NEW_SERVER, appInit, appStart } from '../actions/app'; import { localAuthenticate } from '../utils/localAuthentication'; import { goRoom } from '../utils/goRoom'; diff --git a/app/sagas/encryption.js b/app/sagas/encryption.js index 842cd7a6a..beb33a863 100644 --- a/app/sagas/encryption.js +++ b/app/sagas/encryption.js @@ -1,14 +1,14 @@ import EJSON from 'ejson'; -import { takeLatest, select, put } from 'redux-saga/effects'; +import { put, select, takeLatest } from 'redux-saga/effects'; import { ENCRYPTION } from '../actions/actionsTypes'; import { encryptionSet } from '../actions/encryption'; import { Encryption } from '../lib/encryption'; import Navigation from '../lib/Navigation'; import { - E2E_PUBLIC_KEY, - E2E_PRIVATE_KEY, E2E_BANNER_TYPE, + E2E_PRIVATE_KEY, + E2E_PUBLIC_KEY, E2E_RANDOM_PASSWORD_KEY } from '../lib/encryption/constants'; import database from '../lib/database'; diff --git a/app/sagas/index.js b/app/sagas/index.js index e499d74ec..ab9508dfb 100644 --- a/app/sagas/index.js +++ b/app/sagas/index.js @@ -1,4 +1,6 @@ import { all } from 'redux-saga/effects'; + +import inquiry from '../ee/omnichannel/sagas/inquiry'; import login from './login'; import rooms from './rooms'; import room from './room'; @@ -12,8 +14,6 @@ import inviteLinks from './inviteLinks'; import createDiscussion from './createDiscussion'; import encryption from './encryption'; -import inquiry from '../ee/omnichannel/sagas/inquiry'; - const root = function* root() { yield all([ init(), diff --git a/app/sagas/init.js b/app/sagas/init.js index 57bc33423..e52d23aac 100644 --- a/app/sagas/init.js +++ b/app/sagas/init.js @@ -4,13 +4,13 @@ import RNBootSplash from 'react-native-bootsplash'; import UserPreferences from '../lib/userPreferences'; import { selectServerRequest } from '../actions/server'; import { setAllPreferences } from '../actions/sortPreferences'; -import { toggleCrashReport, toggleAnalyticsEvents } from '../actions/crashReport'; +import { toggleAnalyticsEvents, toggleCrashReport } from '../actions/crashReport'; import { APP } from '../actions/actionsTypes'; import RocketChat from '../lib/rocketchat'; import log from '../utils/log'; import database from '../lib/database'; import { localAuthenticate } from '../utils/localAuthentication'; -import { appStart, ROOT_OUTSIDE, appReady } from '../actions/app'; +import { ROOT_OUTSIDE, appReady, appStart } from '../actions/app'; export const initLocalSettings = function* initLocalSettings() { const sortPreferences = yield RocketChat.getSortPreferences(); diff --git a/app/sagas/inviteLinks.js b/app/sagas/inviteLinks.js index d3ecfbba9..89aeb0b4b 100644 --- a/app/sagas/inviteLinks.js +++ b/app/sagas/inviteLinks.js @@ -1,10 +1,10 @@ import { - put, takeLatest, delay, select + delay, put, select, takeLatest } from 'redux-saga/effects'; import { Alert } from 'react-native'; import { INVITE_LINKS } from '../actions/actionsTypes'; -import { inviteLinksSuccess, inviteLinksFailure, inviteLinksSetInvite } from '../actions/inviteLinks'; +import { inviteLinksFailure, inviteLinksSetInvite, inviteLinksSuccess } from '../actions/inviteLinks'; import RocketChat from '../lib/rocketchat'; import log from '../utils/log'; import Navigation from '../lib/Navigation'; diff --git a/app/sagas/login.js b/app/sagas/login.js index 9381e0459..c608cb65e 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -1,19 +1,20 @@ import { - put, call, takeLatest, select, take, fork, cancel, race, delay + call, cancel, delay, fork, put, race, select, take, takeLatest } from 'redux-saga/effects'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { Q } from '@nozbe/watermelondb'; + import * as types from '../actions/actionsTypes'; import { - appStart, ROOT_SET_USERNAME, ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE + ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE, ROOT_SET_USERNAME, appStart } from '../actions/app'; -import { serverFinishAdd, selectServerRequest } from '../actions/server'; +import { selectServerRequest, serverFinishAdd } from '../actions/server'; import { - loginFailure, loginSuccess, setUser, logout + loginFailure, loginSuccess, logout, setUser } from '../actions/login'; import { roomsRequest } from '../actions/rooms'; import RocketChat from '../lib/rocketchat'; -import log, { logEvent, events } from '../utils/log'; +import log, { events, logEvent } from '../utils/log'; import I18n, { setLanguage } from '../i18n'; import database from '../lib/database'; import EventEmitter from '../utils/events'; @@ -23,7 +24,6 @@ import { localAuthenticate } from '../utils/localAuthentication'; import { setActiveUsers } from '../actions/activeUsers'; import { encryptionInit, encryptionStop } from '../actions/encryption'; import UserPreferences from '../lib/userPreferences'; - import { inquiryRequest, inquiryReset } from '../ee/omnichannel/actions/inquiry'; import { isOmnichannelStatusAvailable } from '../ee/omnichannel/lib'; import Navigation from '../lib/Navigation'; diff --git a/app/sagas/messages.js b/app/sagas/messages.js index 2674be42e..d4d110faa 100644 --- a/app/sagas/messages.js +++ b/app/sagas/messages.js @@ -1,4 +1,4 @@ -import { takeLatest, select } from 'redux-saga/effects'; +import { select, takeLatest } from 'redux-saga/effects'; import { Q } from '@nozbe/watermelondb'; import Navigation from '../lib/Navigation'; diff --git a/app/sagas/room.js b/app/sagas/room.js index 70a0bc4da..813baa1ea 100644 --- a/app/sagas/room.js +++ b/app/sagas/room.js @@ -1,7 +1,7 @@ import { Alert } from 'react-native'; import prompt from 'react-native-prompt-android'; import { - takeLatest, take, select, delay, race, put + delay, put, race, select, take, takeLatest } from 'redux-saga/effects'; import EventEmitter from '../utils/events'; @@ -9,7 +9,7 @@ import Navigation from '../lib/Navigation'; import * as types from '../actions/actionsTypes'; import { removedRoom } from '../actions/room'; import RocketChat from '../lib/rocketchat'; -import log, { logEvent, events } from '../utils/log'; +import log, { events, logEvent } from '../utils/log'; import I18n from '../i18n'; import { showErrorAlert } from '../utils/info'; import { LISTENER } from '../containers/Toast'; @@ -66,7 +66,7 @@ const handleLeaveRoom = function* handleLeaveRoom({ room, roomType, selected }) if (roomType === 'channel') { result = yield RocketChat.leaveRoom(room.rid, room.t); } else if (roomType === 'team') { - result = yield RocketChat.leaveTeam({ teamName: room.name, ...(selected && { rooms: selected }) }); + result = yield RocketChat.leaveTeam({ teamName: room.name, ...selected && { rooms: selected } }); } if (result?.success) { @@ -92,7 +92,7 @@ const handleDeleteRoom = function* handleDeleteRoom({ room, roomType, selected } if (roomType === 'channel') { result = yield RocketChat.deleteRoom(room.rid, room.t); } else if (roomType === 'team') { - result = yield RocketChat.deleteTeam({ teamId: room.teamId, ...(selected && { roomsToRemove: selected }) }); + result = yield RocketChat.deleteTeam({ teamId: room.teamId, ...selected && { roomsToRemove: selected } }); } if (result?.success) { diff --git a/app/sagas/rooms.js b/app/sagas/rooms.js index 4b0047a14..54a1125b3 100644 --- a/app/sagas/rooms.js +++ b/app/sagas/rooms.js @@ -1,11 +1,11 @@ import { - put, select, race, take, fork, cancel, delay + cancel, delay, fork, put, race, select, take } from 'redux-saga/effects'; import { Q } from '@nozbe/watermelondb'; import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import * as types from '../actions/actionsTypes'; -import { roomsSuccess, roomsFailure, roomsRefresh } from '../actions/rooms'; +import { roomsFailure, roomsRefresh, roomsSuccess } from '../actions/rooms'; import database from '../lib/database'; import log from '../utils/log'; import mergeSubscriptionsRooms from '../lib/methods/helpers/mergeSubscriptionsRooms'; diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index 2abf47061..41c04f504 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -8,7 +8,7 @@ import coerce from 'semver/functions/coerce'; import Navigation from '../lib/Navigation'; import { SERVER } from '../actions/actionsTypes'; import { - serverFailure, selectServerRequest, selectServerSuccess, selectServerFailure + selectServerFailure, selectServerRequest, selectServerSuccess, serverFailure } from '../actions/server'; import { clearSettings } from '../actions/settings'; import { setUser } from '../actions/login'; @@ -17,11 +17,10 @@ import database from '../lib/database'; import log, { logServerVersion } from '../utils/log'; import I18n from '../i18n'; import { BASIC_AUTH_KEY, setBasicAuth } from '../utils/fetch'; -import { appStart, ROOT_INSIDE, ROOT_OUTSIDE } from '../actions/app'; +import { ROOT_INSIDE, ROOT_OUTSIDE, appStart } from '../actions/app'; import UserPreferences from '../lib/userPreferences'; import { encryptionStop } from '../actions/encryption'; import SSLPinning from '../utils/sslPinning'; - import { inquiryReset } from '../ee/omnichannel/actions/inquiry'; const getServerInfo = function* getServerInfo({ server, raiseError = true }) { diff --git a/app/sagas/state.js b/app/sagas/state.js index 5b86af2ef..b9afeb4dd 100644 --- a/app/sagas/state.js +++ b/app/sagas/state.js @@ -1,4 +1,4 @@ -import { takeLatest, select } from 'redux-saga/effects'; +import { select, takeLatest } from 'redux-saga/effects'; import RocketChat from '../lib/rocketchat'; import { setBadgeCount } from '../notifications/push'; diff --git a/app/share.tsx b/app/share.tsx index 3ef44a7c4..2efc03df9 100644 --- a/app/share.tsx +++ b/app/share.tsx @@ -10,15 +10,13 @@ import UserPreferences from './lib/userPreferences'; import Navigation from './lib/ShareNavigation'; import store from './lib/createStore'; import { supportSystemTheme } from './utils/deviceInfo'; -import { defaultHeader, themedHeader, getActiveRouteName, navigationTheme } from './utils/navigation'; +import { defaultHeader, getActiveRouteName, navigationTheme, themedHeader } from './utils/navigation'; import RocketChat, { THEME_PREFERENCES_KEY } from './lib/rocketchat'; import { ThemeContext } from './theme'; import { localAuthenticate } from './utils/localAuthentication'; import ScreenLockedView from './views/ScreenLockedView'; - // Outside Stack import WithoutServersView from './views/WithoutServersView'; - // Inside Stack import ShareListView from './views/ShareListView'; import ShareView from './views/ShareView'; @@ -35,7 +33,6 @@ interface IDimensions { fontScale: number } -interface IProps {} interface IState { theme: string, themePreferences: { @@ -55,9 +52,9 @@ const InsideStack = () => { const screenOptions = { ...defaultHeader, - ...themedHeader(theme) + ...themedHeader(theme), }; - screenOptions.headerStyle = {...screenOptions.headerStyle, height: 57}; + screenOptions.headerStyle = { ...screenOptions.headerStyle, height: 57 }; return ( @@ -87,7 +84,7 @@ const OutsideStack = () => { @@ -121,7 +118,7 @@ export const App = ({ root }: any) => ( ); -class Root extends React.Component { +class Root extends React.Component<{}, IState> { constructor(props: any) { super(props); const { width, height, scale, fontScale } = Dimensions.get('screen'); @@ -129,13 +126,13 @@ class Root extends React.Component { theme: defaultTheme(), themePreferences: { currentTheme: supportSystemTheme() ? 'automatic' : 'light', - darkLevel: 'black' + darkLevel: 'black', }, root: '', width, height, scale, - fontScale + fontScale, }; this.init(); } @@ -145,7 +142,7 @@ class Root extends React.Component { unsubscribeTheme(); } - init = async() => { + init = async () => { UserPreferences.getMapAsync(THEME_PREFERENCES_KEY).then(() => this.setTheme()); const currentServer = await UserPreferences.getStringAsync(RocketChat.CURRENT_SERVER); @@ -166,7 +163,7 @@ class Root extends React.Component { setTheme = (newTheme = {}) => { // change theme state - this.setState(prevState => newThemeState(prevState, newTheme), () => { + this.setState((prevState) => newThemeState(prevState, newTheme), () => { const { themePreferences } = this.state; // subscribe to Appearance changes subscribeTheme(themePreferences, this.setTheme); @@ -174,13 +171,13 @@ class Root extends React.Component { } // Dimensions update fires twice - onDimensionsChange = debounce(({window: { width, height, scale, fontScale}}: {window: IDimensions}) => { + onDimensionsChange = debounce(({ window: { width, height, scale, fontScale } }: {window: IDimensions}) => { this.setDimensions({ width, height, scale, fontScale }); }) setDimensions = ({ width, height, scale, fontScale }: IDimensions) => { this.setState({ - width, height, scale, fontScale + width, height, scale, fontScale, }); } @@ -197,7 +194,7 @@ class Root extends React.Component { height, scale, fontScale, - setDimensions: this.setDimensions + setDimensions: this.setDimensions, }} > >({ t export function withTheme(Component: any) { const ThemedComponent = (props: any) => ( - {contexts => } + {(contexts) => } ); hoistNonReactStatics(ThemedComponent, Component); diff --git a/app/utils/avatar.js b/app/utils/avatar.js index 664c3ea45..722d6997d 100644 --- a/app/utils/avatar.js +++ b/app/utils/avatar.js @@ -8,7 +8,7 @@ export const avatarURL = ({ let room; if (type === 'd') { room = text; - } else if (rid && !(compareServerVersion(serverVersion, '3.6.0', methods.lowerThan))) { + } else if (rid && !compareServerVersion(serverVersion, '3.6.0', methods.lowerThan)) { room = `room/${ rid }`; } else { room = `@${ text }`; diff --git a/app/utils/base64-js/base64-js.test.js b/app/utils/base64-js/base64-js.test.js index 83e3de762..6ecad3be7 100644 --- a/app/utils/base64-js/base64-js.test.js +++ b/app/utils/base64-js/base64-js.test.js @@ -4,8 +4,8 @@ import { byteLength, - toByteArray, - fromByteArray + fromByteArray, + toByteArray } from './index'; const map = (arr, callback) => { @@ -14,7 +14,7 @@ const map = (arr, callback) => { let mappedValue; for (let k = 0, len = arr.length; k < len; k += 1) { - if ((typeof arr === 'string' && !!arr.charAt(k))) { + if (typeof arr === 'string' && !!arr.charAt(k)) { kValue = arr.charAt(k); mappedValue = callback(kValue, k, arr); res[k] = mappedValue; diff --git a/app/utils/base64-js/index.js b/app/utils/base64-js/index.js index ef4bcd4ce..22d535825 100644 --- a/app/utils/base64-js/index.js +++ b/app/utils/base64-js/index.js @@ -120,7 +120,7 @@ export const fromByteArray = (uint8) => { // go through the array every three bytes, we'll deal with trailing stuff later for (let i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) + uint8, i, (i + maxChunkLength) > len2 ? len2 : i + maxChunkLength )); } diff --git a/app/utils/fetch.js b/app/utils/fetch.js index a804e0a12..795b3ee34 100644 --- a/app/utils/fetch.js +++ b/app/utils/fetch.js @@ -1,6 +1,7 @@ import { Platform } from 'react-native'; import DeviceInfo from 'react-native-device-info'; import { settings as RocketChatSettings } from '@rocket.chat/sdk'; + import RocketChat from '../lib/rocketchat'; // this form is required by Rocket.Chat's parser in "app/statistics/server/lib/UAParserCustom.js" diff --git a/app/utils/info.js b/app/utils/info.js index 685b2f948..a211d9f75 100644 --- a/app/utils/info.js +++ b/app/utils/info.js @@ -1,11 +1,12 @@ import { Alert } from 'react-native'; + import I18n from '../i18n'; export const showErrorAlert = (message, title, onPress = () => {}) => Alert.alert(title, message, [{ text: 'OK', onPress }], { cancelable: true }); export const showConfirmationAlert = ({ title, message, confirmationText, dismissText = I18n.t('Cancel'), onPress, onCancel -}) => ( +}) => Alert.alert( title || I18n.t('Are_you_sure_question_mark'), message, @@ -22,5 +23,5 @@ export const showConfirmationAlert = ({ } ], { cancelable: false } - ) -); + ); + diff --git a/app/utils/localAuthentication.js b/app/utils/localAuthentication.js index 759a07a0c..2419709f3 100644 --- a/app/utils/localAuthentication.js +++ b/app/utils/localAuthentication.js @@ -7,13 +7,13 @@ import { sha256 } from 'js-sha256'; import UserPreferences from '../lib/userPreferences'; import store from '../lib/createStore'; import database from '../lib/database'; -import { isIOS } from './deviceInfo'; -import EventEmitter from './events'; import { - LOCAL_AUTHENTICATE_EMITTER, LOCKED_OUT_TIMER_KEY, ATTEMPTS_KEY, PASSCODE_KEY, CHANGE_PASSCODE_EMITTER + ATTEMPTS_KEY, CHANGE_PASSCODE_EMITTER, LOCAL_AUTHENTICATE_EMITTER, LOCKED_OUT_TIMER_KEY, PASSCODE_KEY } from '../constants/localAuthentication'; import I18n from '../i18n'; import { setLocalAuthenticated } from '../actions/login'; +import EventEmitter from './events'; +import { isIOS } from './deviceInfo'; export const saveLastLocalAuthenticationSession = async(server, serverRecord) => { const serversDB = database.servers; diff --git a/app/utils/log/index.js b/app/utils/log/index.js index 361ce7055..a0c87216b 100644 --- a/app/utils/log/index.js +++ b/app/utils/log/index.js @@ -1,4 +1,5 @@ import firebaseAnalytics from '@react-native-firebase/analytics'; + import { isFDroidBuild } from '../../constants/environment'; import events from './events'; diff --git a/app/utils/navigation/animations.js b/app/utils/navigation/animations.js index 7b2d15543..7f379fcbf 100644 --- a/app/utils/navigation/animations.js +++ b/app/utils/navigation/animations.js @@ -1,5 +1,5 @@ -import { Easing, Animated } from 'react-native'; -import { TransitionPresets, HeaderStyleInterpolators } from '@react-navigation/stack'; +import { Animated, Easing } from 'react-native'; +import { HeaderStyleInterpolators, TransitionPresets } from '@react-navigation/stack'; import { isAndroid } from '../deviceInfo'; import conditional from './conditional'; diff --git a/app/utils/navigation/index.ts b/app/utils/navigation/index.ts index 8d269e566..98a6e2de2 100644 --- a/app/utils/navigation/index.ts +++ b/app/utils/navigation/index.ts @@ -1,5 +1,5 @@ import { StyleSheet } from 'react-native'; -import { DefaultTheme, DarkTheme } from '@react-navigation/native'; +import { DarkTheme, DefaultTheme } from '@react-navigation/native'; import { themes } from '../../constants/colors'; @@ -8,27 +8,27 @@ export * from './animations'; export const defaultHeader = { headerBackTitleVisible: false, cardOverlayEnabled: true, - cardStyle: { backgroundColor: 'transparent' } + cardStyle: { backgroundColor: 'transparent' }, }; export const cardStyle = { - backgroundColor: 'rgba(0,0,0,0)' + backgroundColor: 'rgba(0,0,0,0)', }; export const borderBottom: any = (theme: any) => ({ borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: themes[theme].headerBorder, - elevation: 0 + elevation: 0, }); export const themedHeader = (theme: any) => ({ headerStyle: { ...borderBottom(theme), - backgroundColor: themes[theme].headerBackground + backgroundColor: themes[theme].headerBackground, }, headerTintColor: themes[theme].headerTintColor, - headerTitleStyle: { color: themes[theme].headerTitleColor } + headerTitleStyle: { color: themes[theme].headerTitleColor }, }); export const navigationTheme = (theme: any) => { @@ -39,8 +39,8 @@ export const navigationTheme = (theme: any) => { colors: { ...defaultNavTheme.colors, background: themes[theme].backgroundColor, - border: themes[theme].borderColor - } + border: themes[theme].borderColor, + }, }; }; diff --git a/app/utils/review.js b/app/utils/review.js index 98d673631..2070dbb83 100644 --- a/app/utils/review.js +++ b/app/utils/review.js @@ -1,12 +1,12 @@ import { Alert, Linking } from 'react-native'; import AsyncStorage from '@react-native-community/async-storage'; -import { isIOS } from './deviceInfo'; import I18n from '../i18n'; -import { showErrorAlert } from './info'; import { STORE_REVIEW_LINK } from '../constants/links'; import { isFDroidBuild } from '../constants/environment'; -import { logEvent, events } from './log'; +import { showErrorAlert } from './info'; +import { isIOS } from './deviceInfo'; +import { events, logEvent } from './log'; const store = isIOS ? 'App Store' : 'Play Store'; diff --git a/app/utils/room.js b/app/utils/room.js index fef926d5f..e6955d8ee 100644 --- a/app/utils/room.js +++ b/app/utils/room.js @@ -1,6 +1,6 @@ import moment from 'moment'; -import { themes } from '../constants/colors'; +import { themes } from '../constants/colors'; import I18n from '../i18n'; export const isBlocked = (room) => { diff --git a/app/utils/shortnameToUnicode/index.js b/app/utils/shortnameToUnicode/index.js index 5c6f7093e..0ecd8e732 100644 --- a/app/utils/shortnameToUnicode/index.js +++ b/app/utils/shortnameToUnicode/index.js @@ -31,7 +31,7 @@ const shortnameToUnicode = (str) => { str = str.replace(shortnamePattern, replaceShortNameWithUnicode); str = str.replace(regAscii, (entire, m1, m2, m3) => { - if (!m3 || (!(unescapeHTML(m3) in ascii))) { + if (!m3 || !(unescapeHTML(m3) in ascii)) { // if the ascii doesnt exist just return the entire match return entire; } diff --git a/app/utils/sslPinning.js b/app/utils/sslPinning.js index 00d807d4e..ce5b1bdea 100644 --- a/app/utils/sslPinning.js +++ b/app/utils/sslPinning.js @@ -1,10 +1,10 @@ -import { NativeModules, Platform, Alert } from 'react-native'; +import { Alert, NativeModules, Platform } from 'react-native'; import DocumentPicker from 'react-native-document-picker'; import * as FileSystem from 'expo-file-system'; -import { extractHostname } from './server'; import UserPreferences from '../lib/userPreferences'; import I18n from '../i18n'; +import { extractHostname } from './server'; const { SSLPinning } = NativeModules; diff --git a/app/utils/theme.js b/app/utils/theme.js index 3c265eb5a..877ee13f1 100644 --- a/app/utils/theme.js +++ b/app/utils/theme.js @@ -2,8 +2,8 @@ import { Appearance } from 'react-native-appearance'; import changeNavigationBarColor from 'react-native-navigation-bar-color'; import setRootViewColor from 'rn-root-view'; -import { isAndroid } from './deviceInfo'; import { themes } from '../constants/colors'; +import { isAndroid } from './deviceInfo'; let themeListener; diff --git a/app/utils/twoFactor.js b/app/utils/twoFactor.js index ae5bc9b07..78049a6ba 100644 --- a/app/utils/twoFactor.js +++ b/app/utils/twoFactor.js @@ -1,7 +1,7 @@ import { settings } from '@rocket.chat/sdk'; -import EventEmitter from './events'; import { TWO_FACTOR } from '../containers/TwoFactor'; +import EventEmitter from './events'; export const twoFactor = ({ method, invalid }) => new Promise((resolve, reject) => { EventEmitter.emit(TWO_FACTOR, { diff --git a/app/views/AddExistingChannelView.js b/app/views/AddExistingChannelView.js index 0edced4b0..9174fe78e 100644 --- a/app/views/AddExistingChannelView.js +++ b/app/views/AddExistingChannelView.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, FlatList + FlatList, View } from 'react-native'; import { connect } from 'react-redux'; import { Q } from '@nozbe/watermelondb'; diff --git a/app/views/AttachmentView.js b/app/views/AttachmentView.js index c07ed71b9..b213390d2 100644 --- a/app/views/AttachmentView.js +++ b/app/views/AttachmentView.js @@ -1,5 +1,5 @@ import React from 'react'; -import { StyleSheet, View, PermissionsAndroid } from 'react-native'; +import { PermissionsAndroid, StyleSheet, View } from 'react-native'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import CameraRoll from '@react-native-community/cameraroll'; diff --git a/app/views/AuthLoadingView.js b/app/views/AuthLoadingView.js index b0ecf2474..318cd9aeb 100644 --- a/app/views/AuthLoadingView.js +++ b/app/views/AuthLoadingView.js @@ -1,6 +1,6 @@ import React from 'react'; import { - View, Text, StyleSheet, ActivityIndicator + ActivityIndicator, StyleSheet, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; @@ -9,7 +9,6 @@ import I18n from '../i18n'; import StatusBar from '../containers/StatusBar'; import { withTheme } from '../theme'; import { themes } from '../constants/colors'; - import sharedStyles from './Styles'; const styles = StyleSheet.create({ diff --git a/app/views/AutoTranslateView/index.js b/app/views/AutoTranslateView/index.js index 962c4883a..7bea93b78 100644 --- a/app/views/AutoTranslateView/index.js +++ b/app/views/AutoTranslateView/index.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FlatList, Switch, StyleSheet } from 'react-native'; +import { FlatList, StyleSheet, Switch } from 'react-native'; import RocketChat from '../../lib/rocketchat'; import I18n from '../../i18n'; @@ -9,7 +9,7 @@ import * as List from '../../containers/List'; import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; const styles = StyleSheet.create({ list: { diff --git a/app/views/ChangePasscodeView.js b/app/views/ChangePasscodeView.js index 535ba71d4..398253520 100644 --- a/app/views/ChangePasscodeView.js +++ b/app/views/ChangePasscodeView.js @@ -8,7 +8,7 @@ import Modal from 'react-native-modal'; import Touchable from 'react-native-platform-touchable'; import { withTheme } from '../theme'; -import { isTablet, hasNotch } from '../utils/deviceInfo'; +import { hasNotch, isTablet } from '../utils/deviceInfo'; import { TYPE } from '../containers/Passcode/constants'; import { PasscodeChoose } from '../containers/Passcode'; import EventEmitter from '../utils/events'; @@ -64,12 +64,12 @@ const ChangePasscodeView = React.memo(({ theme }) => { Orientation.lockToPortrait(); } const listener = EventEmitter.addEventListener(CHANGE_PASSCODE_EMITTER, showChangePasscode); - return (() => { + return () => { if (!isTablet) { Orientation.unlockAllOrientations(); } EventEmitter.removeListener(CHANGE_PASSCODE_EMITTER, listener); - }); + }; }, []); return ( diff --git a/app/views/CreateChannelView.js b/app/views/CreateChannelView.js index 78f4ea42a..44357af41 100644 --- a/app/views/CreateChannelView.js +++ b/app/views/CreateChannelView.js @@ -2,16 +2,15 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { - View, Text, Switch, ScrollView, StyleSheet, FlatList + FlatList, ScrollView, StyleSheet, Switch, Text, View } from 'react-native'; import { dequal } from 'dequal'; -import * as List from '../containers/List'; +import * as List from '../containers/List'; import TextInput from '../presentation/TextInput'; import Loading from '../containers/Loading'; import { createChannelRequest as createChannelRequestAction } from '../actions/createChannel'; import { removeUser as removeUserAction } from '../actions/selectedUsers'; -import sharedStyles from './Styles'; import KeyboardView from '../presentation/KeyboardView'; import scrollPersistTaps from '../utils/scrollPersistTaps'; import I18n from '../i18n'; @@ -22,8 +21,9 @@ import { SWITCH_TRACK_COLOR, themes } from '../constants/colors'; import { withTheme } from '../theme'; import { Review } from '../utils/review'; import { getUserSelector } from '../selectors/login'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; import SafeAreaView from '../containers/SafeAreaView'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ container: { diff --git a/app/views/CreateDiscussionView/SelectChannel.js b/app/views/CreateDiscussionView/SelectChannel.js index c7b6acbfb..043d96113 100644 --- a/app/views/CreateDiscussionView/SelectChannel.js +++ b/app/views/CreateDiscussionView/SelectChannel.js @@ -8,7 +8,6 @@ import RocketChat from '../../lib/rocketchat'; import I18n from '../../i18n'; import { MultiSelect } from '../../containers/UIKit/MultiSelect'; import { themes } from '../../constants/colors'; - import styles from './styles'; const SelectChannel = ({ diff --git a/app/views/CreateDiscussionView/SelectUsers.js b/app/views/CreateDiscussionView/SelectUsers.js index 8500ee15c..ff613a000 100644 --- a/app/views/CreateDiscussionView/SelectUsers.js +++ b/app/views/CreateDiscussionView/SelectUsers.js @@ -10,9 +10,8 @@ import RocketChat from '../../lib/rocketchat'; import database from '../../lib/database'; import I18n from '../../i18n'; import { MultiSelect } from '../../containers/UIKit/MultiSelect'; - -import styles from './styles'; import { themes } from '../../constants/colors'; +import styles from './styles'; const SelectUsers = ({ server, token, userId, selected, onUserSelect, blockUnauthenticatedAccess, serverVersion, theme diff --git a/app/views/CreateDiscussionView/index.js b/app/views/CreateDiscussionView/index.js index 46b2d6cde..3a6831f95 100644 --- a/app/views/CreateDiscussionView/index.js +++ b/app/views/CreateDiscussionView/index.js @@ -1,7 +1,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import { ScrollView, Text, Switch } from 'react-native'; +import { ScrollView, Switch, Text } from 'react-native'; import Loading from '../../containers/Loading'; import KeyboardView from '../../presentation/KeyboardView'; @@ -17,15 +17,13 @@ import RocketChat from '../../lib/rocketchat'; import Navigation from '../../lib/Navigation'; import { createDiscussionRequest } from '../../actions/createDiscussion'; import { showErrorAlert } from '../../utils/info'; - -import SelectChannel from './SelectChannel'; -import SelectUsers from './SelectUsers'; - -import styles from './styles'; import SafeAreaView from '../../containers/SafeAreaView'; import { goRoom } from '../../utils/goRoom'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; import { E2E_ROOM_TYPES } from '../../lib/encryption/constants'; +import styles from './styles'; +import SelectUsers from './SelectUsers'; +import SelectChannel from './SelectChannel'; class CreateChannelView extends React.Component { propTypes = { @@ -97,15 +95,14 @@ class CreateChannelView extends React.Component { const showCloseModal = route.params?.showCloseModal; navigation.setOptions({ title: I18n.t('Create_Discussion'), - headerRight: ( + headerRight: this.valid() ? () => ( ) - : null - ), + : null, headerLeft: showCloseModal ? () => : undefined }); } diff --git a/app/views/DefaultBrowserView.js b/app/views/DefaultBrowserView.js index 568802360..529361f30 100644 --- a/app/views/DefaultBrowserView.js +++ b/app/views/DefaultBrowserView.js @@ -11,7 +11,7 @@ import { DEFAULT_BROWSER_KEY } from '../utils/openLink'; import { isIOS } from '../utils/deviceInfo'; import SafeAreaView from '../containers/SafeAreaView'; import UserPreferences from '../lib/userPreferences'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; const DEFAULT_BROWSERS = [ { diff --git a/app/views/DirectoryView/Options.js b/app/views/DirectoryView/Options.js index a88bf42be..e673966aa 100644 --- a/app/views/DirectoryView/Options.js +++ b/app/views/DirectoryView/Options.js @@ -1,15 +1,15 @@ import React, { PureComponent } from 'react'; import { - View, Text, Animated, Easing, TouchableWithoutFeedback, Switch + Animated, Easing, Switch, Text, TouchableWithoutFeedback, View } from 'react-native'; import PropTypes from 'prop-types'; -import styles from './styles'; import Touch from '../../utils/touch'; import { CustomIcon } from '../../lib/Icons'; import Check from '../../containers/Check'; import I18n from '../../i18n'; import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors'; +import styles from './styles'; const ANIMATION_DURATION = 200; const ANIMATION_PROPS = { diff --git a/app/views/DirectoryView/index.js b/app/views/DirectoryView/index.js index 6e60b44bc..41f7f4469 100644 --- a/app/views/DirectoryView/index.js +++ b/app/views/DirectoryView/index.js @@ -1,11 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, FlatList, Text + FlatList, Text, View } from 'react-native'; import { connect } from 'react-redux'; -import * as List from '../../containers/List'; +import * as List from '../../containers/List'; import Touch from '../../utils/touch'; import RocketChat from '../../lib/rocketchat'; import DirectoryItem from '../../presentation/DirectoryItem'; @@ -17,14 +17,14 @@ import StatusBar from '../../containers/StatusBar'; import ActivityIndicator from '../../containers/ActivityIndicator'; import * as HeaderButton from '../../containers/HeaderButton'; import debounce from '../../utils/debounce'; -import log, { logEvent, events } from '../../utils/log'; -import Options from './Options'; +import log, { events, logEvent } from '../../utils/log'; import { withTheme } from '../../theme'; import { themes } from '../../constants/colors'; -import styles from './styles'; import { getUserSelector } from '../../selectors/login'; import SafeAreaView from '../../containers/SafeAreaView'; import { goRoom } from '../../utils/goRoom'; +import styles from './styles'; +import Options from './Options'; class DirectoryView extends React.Component { static navigationOptions = ({ navigation, isMasterDetail }) => { @@ -93,7 +93,7 @@ class DirectoryView extends React.Component { query, offset: data.length, count: 50, - sort: (type === 'users') ? { username: 1 } : { usersCount: -1 } + sort: type === 'users' ? { username: 1 } : { usersCount: -1 } }); if (directories.success) { this.setState({ diff --git a/app/views/E2EEncryptionSecurityView.js b/app/views/E2EEncryptionSecurityView.js index 661d6e84d..e29f38288 100644 --- a/app/views/E2EEncryptionSecurityView.js +++ b/app/views/E2EEncryptionSecurityView.js @@ -1,19 +1,18 @@ import React from 'react'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; import I18n from '../i18n'; -import log, { logEvent, events } from '../utils/log'; +import log, { events, logEvent } from '../utils/log'; import { withTheme } from '../theme'; import SafeAreaView from '../containers/SafeAreaView'; import TextInput from '../containers/TextInput'; import Button from '../containers/Button'; import { getUserSelector } from '../selectors/login'; import { PADDING_HORIZONTAL } from '../containers/List/constants'; -import sharedStyles from './Styles'; import { themes } from '../constants/colors'; import { Encryption } from '../lib/encryption'; import RocketChat from '../lib/rocketchat'; @@ -22,6 +21,7 @@ import { showConfirmationAlert, showErrorAlert } from '../utils/info'; import EventEmitter from '../utils/events'; import { LISTENER } from '../containers/Toast'; import debounce from '../utils/debounce'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ container: { diff --git a/app/views/E2EEnterYourPasswordView.js b/app/views/E2EEnterYourPasswordView.js index 563b1d9a7..f581e4487 100644 --- a/app/views/E2EEnterYourPasswordView.js +++ b/app/views/E2EEnterYourPasswordView.js @@ -1,10 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Text, StyleSheet, ScrollView } from 'react-native'; +import { ScrollView, StyleSheet, Text } from 'react-native'; import { connect } from 'react-redux'; import I18n from '../i18n'; -import sharedStyles from './Styles'; import { withTheme } from '../theme'; import Button from '../containers/Button'; import { themes } from '../constants/colors'; @@ -15,7 +14,8 @@ import { encryptionDecodeKey as encryptionDecodeKeyAction } from '../actions/enc import scrollPersistTaps from '../utils/scrollPersistTaps'; import KeyboardView from '../presentation/KeyboardView'; import StatusBar from '../containers/StatusBar'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ container: { diff --git a/app/views/E2ESaveYourPasswordView.js b/app/views/E2ESaveYourPasswordView.js index 9163047cd..850bd19f0 100644 --- a/app/views/E2ESaveYourPasswordView.js +++ b/app/views/E2ESaveYourPasswordView.js @@ -2,11 +2,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { - Text, - View, Clipboard, ScrollView, - StyleSheet + StyleSheet, + Text, + View } from 'react-native'; import { encryptionSetBanner as encryptionSetBannerAction } from '../actions/encryption'; @@ -15,15 +15,15 @@ import * as HeaderButton from '../containers/HeaderButton'; import scrollPersistTaps from '../utils/scrollPersistTaps'; import SafeAreaView from '../containers/SafeAreaView'; import UserPreferences from '../lib/userPreferences'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; import StatusBar from '../containers/StatusBar'; import { LISTENER } from '../containers/Toast'; import { themes } from '../constants/colors'; import EventEmitter from '../utils/events'; import Button from '../containers/Button'; import { withTheme } from '../theme'; -import sharedStyles from './Styles'; import I18n from '../i18n'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ container: { diff --git a/app/views/ForgotPasswordView.js b/app/views/ForgotPasswordView.js index 319682c75..8f38256f8 100644 --- a/app/views/ForgotPasswordView.js +++ b/app/views/ForgotPasswordView.js @@ -4,7 +4,6 @@ import PropTypes from 'prop-types'; import TextInput from '../containers/TextInput'; import Button from '../containers/Button'; -import sharedStyles from './Styles'; import { showErrorAlert } from '../utils/info'; import isValidEmail from '../utils/isValidEmail'; import I18n from '../i18n'; @@ -12,7 +11,8 @@ import RocketChat from '../lib/rocketchat'; import { withTheme } from '../theme'; import { themes } from '../constants/colors'; import FormContainer, { FormContainerInner } from '../containers/FormContainer'; -import { logEvent, events } from '../utils/log'; +import { events, logEvent } from '../utils/log'; +import sharedStyles from './Styles'; class ForgotPasswordView extends React.Component { static navigationOptions = ({ route }) => ({ diff --git a/app/views/ForwardLivechatView.js b/app/views/ForwardLivechatView.js index 3807c9894..00b47c146 100644 --- a/app/views/ForwardLivechatView.js +++ b/app/views/ForwardLivechatView.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, View } from 'react-native'; import { connect } from 'react-redux'; import I18n from '../i18n'; diff --git a/app/views/InviteUsersEditView/index.js b/app/views/InviteUsersEditView/index.js index bba6ef247..de632a829 100644 --- a/app/views/InviteUsersEditView/index.js +++ b/app/views/InviteUsersEditView/index.js @@ -5,18 +5,18 @@ import { connect } from 'react-redux'; import RNPickerSelect from 'react-native-picker-select'; import { - inviteLinksSetParams as inviteLinksSetParamsAction, - inviteLinksCreate as inviteLinksCreateAction + inviteLinksCreate as inviteLinksCreateAction, + inviteLinksSetParams as inviteLinksSetParamsAction } from '../../actions/inviteLinks'; import * as List from '../../containers/List'; -import styles from './styles'; import Button from '../../containers/Button'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; +import styles from './styles'; const OPTIONS = { days: [{ diff --git a/app/views/InviteUsersEditView/styles.js b/app/views/InviteUsersEditView/styles.js index bb2950300..3183999e3 100644 --- a/app/views/InviteUsersEditView/styles.js +++ b/app/views/InviteUsersEditView/styles.js @@ -1,6 +1,6 @@ import { StyleSheet } from 'react-native'; -import { PADDING_HORIZONTAL } from '../../containers/List/constants'; +import { PADDING_HORIZONTAL } from '../../containers/List/constants'; import sharedStyles from '../Styles'; export default StyleSheet.create({ diff --git a/app/views/InviteUsersView/index.js b/app/views/InviteUsersView/index.js index c6be109a9..f7973fcd4 100644 --- a/app/views/InviteUsersView/index.js +++ b/app/views/InviteUsersView/index.js @@ -1,15 +1,14 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, Share, ScrollView } from 'react-native'; +import { ScrollView, Share, View } from 'react-native'; import moment from 'moment'; import { connect } from 'react-redux'; import { - inviteLinksCreate as inviteLinksCreateAction, - inviteLinksClear as inviteLinksClearAction + inviteLinksClear as inviteLinksClearAction, + inviteLinksCreate as inviteLinksCreateAction } from '../../actions/inviteLinks'; import RCTextInput from '../../containers/TextInput'; -import styles from './styles'; import Markdown from '../../containers/markdown'; import Button from '../../containers/Button'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; @@ -18,7 +17,8 @@ import StatusBar from '../../containers/StatusBar'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; +import styles from './styles'; class InviteUsersView extends React.Component { static navigationOptions = () => ({ diff --git a/app/views/InviteUsersView/styles.js b/app/views/InviteUsersView/styles.js index eb8648e50..d79ba2934 100644 --- a/app/views/InviteUsersView/styles.js +++ b/app/views/InviteUsersView/styles.js @@ -1,4 +1,5 @@ import { StyleSheet } from 'react-native'; + import { PADDING_HORIZONTAL } from '../../containers/List/constants'; export default StyleSheet.create({ diff --git a/app/views/JitsiMeetView.js b/app/views/JitsiMeetView.js index 6b7a15688..0c71941b9 100644 --- a/app/views/JitsiMeetView.js +++ b/app/views/JitsiMeetView.js @@ -6,14 +6,11 @@ import { connect } from 'react-redux'; import RocketChat from '../lib/rocketchat'; import { getUserSelector } from '../selectors/login'; - +import { events, logEvent } from '../utils/log'; import sharedStyles from './Styles'; -import { logEvent, events } from '../utils/log'; - -const formatUrl = (url, baseUrl, uriSize, avatarAuthURLFragment) => ( - `${ baseUrl }/avatar/${ url }?format=png&width=${ uriSize }&height=${ uriSize }${ avatarAuthURLFragment }` -); +const formatUrl = (url, baseUrl, uriSize, avatarAuthURLFragment) => + `${ baseUrl }/avatar/${ url }?format=png&width=${ uriSize }&height=${ uriSize }${ avatarAuthURLFragment }`; class JitsiMeetView extends React.Component { static propTypes = { navigation: PropTypes.object, diff --git a/app/views/LanguageView/index.js b/app/views/LanguageView/index.js index b2e6e1079..7505af637 100644 --- a/app/views/LanguageView/index.js +++ b/app/views/LanguageView/index.js @@ -7,13 +7,13 @@ import RNRestart from 'react-native-restart'; import RocketChat from '../../lib/rocketchat'; import I18n, { LANGUAGES, isRTL } from '../../i18n'; import { showErrorAlert } from '../../utils/info'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import { setUser as setUserAction } from '../../actions/login'; import StatusBar from '../../containers/StatusBar'; import * as List from '../../containers/List'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; -import { appStart as appStartAction, ROOT_LOADING, ROOT_INSIDE } from '../../actions/app'; +import { ROOT_INSIDE, ROOT_LOADING, appStart as appStartAction } from '../../actions/app'; import { getUserSelector } from '../../selectors/login'; import database from '../../lib/database'; import SafeAreaView from '../../containers/SafeAreaView'; @@ -54,7 +54,7 @@ class LanguageView extends React.Component { formIsChanged = (language) => { const { user } = this.props; - return (user.language !== language); + return user.language !== language; } submit = async(language) => { diff --git a/app/views/LivechatEditView.js b/app/views/LivechatEditView.js index 6ba4143e7..0013cb68c 100644 --- a/app/views/LivechatEditView.js +++ b/app/views/LivechatEditView.js @@ -1,6 +1,6 @@ -import React, { useState, useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; -import { Text, StyleSheet, ScrollView } from 'react-native'; +import { ScrollView, StyleSheet, Text } from 'react-native'; import { connect } from 'react-redux'; import { withTheme } from '../theme'; @@ -9,8 +9,6 @@ import TextInput from '../containers/TextInput'; import KeyboardView from '../presentation/KeyboardView'; import RocketChat from '../lib/rocketchat'; import I18n from '../i18n'; - -import sharedStyles from './Styles'; import { LISTENER } from '../containers/Toast'; import EventEmitter from '../utils/events'; import scrollPersistTaps from '../utils/scrollPersistTaps'; @@ -18,6 +16,7 @@ import { getUserSelector } from '../selectors/login'; import Chips from '../containers/UIKit/MultiSelect/Chips'; import Button from '../containers/Button'; import SafeAreaView from '../containers/SafeAreaView'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ container: { @@ -276,9 +275,9 @@ LivechatEditView.propTypes = { route: PropTypes.object, theme: PropTypes.string }; -LivechatEditView.navigationOptions = ({ +LivechatEditView.navigationOptions = { title: I18n.t('Livechat_edit') -}); +}; const mapStateToProps = state => ({ server: state.server.server, diff --git a/app/views/LoginView.js b/app/views/LoginView.js index 31a56ae13..f1a57bced 100644 --- a/app/views/LoginView.js +++ b/app/views/LoginView.js @@ -1,12 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - Text, View, StyleSheet, Keyboard, Alert + Alert, Keyboard, StyleSheet, Text, View } from 'react-native'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; -import sharedStyles from './Styles'; import Button from '../containers/Button'; import I18n from '../i18n'; import * as HeaderButton from '../containers/HeaderButton'; @@ -16,6 +15,7 @@ import FormContainer, { FormContainerInner } from '../containers/FormContainer'; import TextInput from '../containers/TextInput'; import { loginRequest as loginRequestAction } from '../actions/login'; import LoginServices from '../containers/LoginServices'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ registerDisabled: { diff --git a/app/views/MessagesView/index.js b/app/views/MessagesView/index.js index f6ea91942..97a4ee1e8 100644 --- a/app/views/MessagesView/index.js +++ b/app/views/MessagesView/index.js @@ -1,10 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FlatList, View, Text } from 'react-native'; +import { FlatList, Text, View } from 'react-native'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; -import styles from './styles'; import Message from '../../containers/message'; import ActivityIndicator from '../../containers/ActivityIndicator'; import I18n from '../../i18n'; @@ -17,6 +16,7 @@ import { getUserSelector } from '../../selectors/login'; import { withActionSheet } from '../../containers/ActionSheet'; import SafeAreaView from '../../containers/SafeAreaView'; import getThreadName from '../../lib/methods/getThreadName'; +import styles from './styles'; class MessagesView extends React.Component { static propTypes = { @@ -130,7 +130,7 @@ class MessagesView extends React.Component { onPress: () => this.jumpToMessage({ item }) }); - return ({ + return { // Files Messages Screen Files: { name: I18n.t('Files'), @@ -225,7 +225,7 @@ class MessagesView extends React.Component { action: () => ({ title: I18n.t('Unpin'), icon: 'pin', onPress: this.handleActionPress }), handleActionPress: message => RocketChat.togglePinMessage(message._id, message.pinned) } - }[name]); + }[name]; } load = async() => { diff --git a/app/views/ModalBlockView.js b/app/views/ModalBlockView.js index 85eee8492..33e330ab7 100644 --- a/app/views/ModalBlockView.js +++ b/app/views/ModalBlockView.js @@ -11,11 +11,10 @@ import * as HeaderButton from '../containers/HeaderButton'; import { modalBlockWithContext } from '../containers/UIKit/MessageBlock'; import RocketChat from '../lib/rocketchat'; import ActivityIndicator from '../containers/ActivityIndicator'; -import { MODAL_ACTIONS, CONTAINER_TYPES } from '../lib/methods/actions'; - -import sharedStyles from './Styles'; +import { CONTAINER_TYPES, MODAL_ACTIONS } from '../lib/methods/actions'; import { textParser } from '../containers/UIKit/utils'; import Navigation from '../lib/Navigation'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ container: { diff --git a/app/views/NewMessageView.js b/app/views/NewMessageView.js index 8d5f62ceb..455330a44 100644 --- a/app/views/NewMessageView.js +++ b/app/views/NewMessageView.js @@ -1,19 +1,18 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, StyleSheet, FlatList, Text + FlatList, StyleSheet, Text, View } from 'react-native'; import { connect } from 'react-redux'; import { Q } from '@nozbe/watermelondb'; -import * as List from '../containers/List'; +import * as List from '../containers/List'; import Touch from '../utils/touch'; import database from '../lib/database'; import RocketChat from '../lib/rocketchat'; import UserItem from '../presentation/UserItem'; -import sharedStyles from './Styles'; import I18n from '../i18n'; -import log, { logEvent, events } from '../utils/log'; +import log, { events, logEvent } from '../utils/log'; import SearchBox from '../containers/SearchBox'; import { CustomIcon } from '../lib/Icons'; import * as HeaderButton from '../containers/HeaderButton'; @@ -26,6 +25,7 @@ import { createChannelRequest } from '../actions/createChannel'; import { goRoom } from '../utils/goRoom'; import SafeAreaView from '../containers/SafeAreaView'; import { compareServerVersion, methods } from '../lib/utils'; +import sharedStyles from './Styles'; const QUERY_SIZE = 50; @@ -181,12 +181,12 @@ class NewMessageView extends React.Component { first: true })} {compareServerVersion(serverVersion, '3.13.0', methods.greaterThanOrEqualTo) - ? (this.renderButton({ + ? this.renderButton({ onPress: this.createTeam, title: I18n.t('Create_Team'), icon: 'teams', testID: 'new-message-view-create-team' - })) : null} + }) : null} {maxUsers > 2 ? this.renderButton({ onPress: this.createGroupChat, title: I18n.t('Create_Direct_Messages'), diff --git a/app/views/NewServerView/ServerInput/Item.js b/app/views/NewServerView/ServerInput/Item.js index b249c88e0..417a2b3f5 100644 --- a/app/views/NewServerView/ServerInput/Item.js +++ b/app/views/NewServerView/ServerInput/Item.js @@ -1,6 +1,6 @@ import React from 'react'; import { - View, StyleSheet, Text + StyleSheet, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import { BorderlessButton } from 'react-native-gesture-handler'; diff --git a/app/views/NewServerView/ServerInput/index.js b/app/views/NewServerView/ServerInput/index.js index 6088e4ef6..08bf30054 100644 --- a/app/views/NewServerView/ServerInput/index.js +++ b/app/views/NewServerView/ServerInput/index.js @@ -1,12 +1,12 @@ import React, { useState } from 'react'; -import { View, FlatList, StyleSheet } from 'react-native'; +import { FlatList, StyleSheet, View } from 'react-native'; import PropTypes from 'prop-types'; import TextInput from '../../../containers/TextInput'; import * as List from '../../../containers/List'; import { themes } from '../../../constants/colors'; -import Item from './Item'; import I18n from '../../../i18n'; +import Item from './Item'; const styles = StyleSheet.create({ container: { diff --git a/app/views/NewServerView/index.js b/app/views/NewServerView/index.js index 27422dec8..72fbc63a7 100644 --- a/app/views/NewServerView/index.js +++ b/app/views/NewServerView/index.js @@ -1,14 +1,14 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - Text, Keyboard, StyleSheet, View, BackHandler + BackHandler, Keyboard, StyleSheet, Text, View } from 'react-native'; import { connect } from 'react-redux'; import { Base64 } from 'js-base64'; import parse from 'url-parse'; import { Q } from '@nozbe/watermelondb'; - import { TouchableOpacity } from 'react-native-gesture-handler'; + import UserPreferences from '../../lib/userPreferences'; import EventEmitter from '../../utils/events'; import { selectServerRequest, serverRequest } from '../../actions/server'; @@ -19,17 +19,17 @@ import OrSeparator from '../../containers/OrSeparator'; import FormContainer, { FormContainerInner } from '../../containers/FormContainer'; import I18n from '../../i18n'; import { themes } from '../../constants/colors'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; import { animateNextTransition } from '../../utils/layoutAnimation'; import { withTheme } from '../../theme'; -import { setBasicAuth, BASIC_AUTH_KEY } from '../../utils/fetch'; +import { BASIC_AUTH_KEY, setBasicAuth } from '../../utils/fetch'; import * as HeaderButton from '../../containers/HeaderButton'; import { showConfirmationAlert } from '../../utils/info'; import database from '../../lib/database'; -import ServerInput from './ServerInput'; import { sanitizeLikeString } from '../../lib/database/utils'; import SSLPinning from '../../utils/sslPinning'; import RocketChat from '../../lib/rocketchat'; +import ServerInput from './ServerInput'; const styles = StyleSheet.create({ title: { diff --git a/app/views/NotificationPreferencesView/index.js b/app/views/NotificationPreferencesView/index.js index debea1492..a9356f3e1 100644 --- a/app/views/NotificationPreferencesView/index.js +++ b/app/views/NotificationPreferencesView/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Switch, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Switch, Text } from 'react-native'; import PropTypes from 'prop-types'; import database from '../../lib/database'; @@ -12,8 +12,8 @@ import { withTheme } from '../../theme'; import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import SafeAreaView from '../../containers/SafeAreaView'; import log, { events, logEvent } from '../../utils/log'; -import { OPTIONS } from './options'; import sharedStyles from '../Styles'; +import { OPTIONS } from './options'; const styles = StyleSheet.create({ pickerText: { diff --git a/app/views/OnboardingView/index.js b/app/views/OnboardingView/index.js index a3cd50c28..5ae774d02 100644 --- a/app/views/OnboardingView/index.js +++ b/app/views/OnboardingView/index.js @@ -1,18 +1,18 @@ import React from 'react'; import { - View, Text, Image, Linking + Image, Linking, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import Orientation from 'react-native-orientation-locker'; import I18n from '../../i18n'; import Button from '../../containers/Button'; -import styles from './styles'; import { isTablet } from '../../utils/deviceInfo'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import FormContainer, { FormContainerInner } from '../../containers/FormContainer'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; +import styles from './styles'; class OnboardingView extends React.Component { static navigationOptions = { diff --git a/app/views/OnboardingView/styles.js b/app/views/OnboardingView/styles.js index 809fcf36e..dc26c82ec 100644 --- a/app/views/OnboardingView/styles.js +++ b/app/views/OnboardingView/styles.js @@ -1,6 +1,6 @@ import { StyleSheet } from 'react-native'; -import { verticalScale, moderateScale } from '../../utils/scaling'; +import { moderateScale, verticalScale } from '../../utils/scaling'; import { isTablet } from '../../utils/deviceInfo'; import sharedStyles from '../Styles'; diff --git a/app/views/PickerView.js b/app/views/PickerView.js index b11ae6247..3fe263011 100644 --- a/app/views/PickerView.js +++ b/app/views/PickerView.js @@ -1,18 +1,17 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, FlatList, StyleSheet, Text + FlatList, StyleSheet, Text, View } from 'react-native'; import I18n from '../i18n'; import { withTheme } from '../theme'; import { themes } from '../constants/colors'; import debounce from '../utils/debounce'; -import sharedStyles from './Styles'; - import * as List from '../containers/List'; import SearchBox from '../containers/SearchBox'; import SafeAreaView from '../containers/SafeAreaView'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ search: { diff --git a/app/views/ProfileView/index.js b/app/views/ProfileView/index.js index 7e97422df..e726ae693 100644 --- a/app/views/ProfileView/index.js +++ b/app/views/ProfileView/index.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, ScrollView, Keyboard } from 'react-native'; +import { Keyboard, ScrollView, View } from 'react-native'; import { connect } from 'react-redux'; import prompt from 'react-native-prompt-android'; import SHA256 from 'js-sha256'; @@ -12,14 +12,13 @@ import omit from 'lodash/omit'; import Touch from '../../utils/touch'; import KeyboardView from '../../presentation/KeyboardView'; import sharedStyles from '../Styles'; -import styles from './styles'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; -import { showErrorAlert, showConfirmationAlert } from '../../utils/info'; +import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; import { LISTENER } from '../../containers/Toast'; import EventEmitter from '../../utils/events'; import RocketChat from '../../lib/rocketchat'; import RCTextInput from '../../containers/TextInput'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import I18n from '../../i18n'; import Button from '../../containers/Button'; import Avatar from '../../containers/Avatar'; @@ -31,6 +30,7 @@ import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import { getUserSelector } from '../../selectors/login'; import SafeAreaView from '../../containers/SafeAreaView'; +import styles from './styles'; class ProfileView extends React.Component { static navigationOptions = ({ navigation, isMasterDetail }) => { diff --git a/app/views/ReadReceiptView/index.js b/app/views/ReadReceiptView/index.js index b413a7674..dc3352f9d 100644 --- a/app/views/ReadReceiptView/index.js +++ b/app/views/ReadReceiptView/index.js @@ -1,13 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FlatList, View, Text } from 'react-native'; +import { FlatList, Text, View } from 'react-native'; import { dequal } from 'dequal'; import moment from 'moment'; import { connect } from 'react-redux'; -import * as List from '../../containers/List'; +import * as List from '../../containers/List'; import Avatar from '../../containers/Avatar'; -import styles from './styles'; import ActivityIndicator from '../../containers/ActivityIndicator'; import * as HeaderButton from '../../containers/HeaderButton'; import I18n from '../../i18n'; @@ -16,6 +15,7 @@ import StatusBar from '../../containers/StatusBar'; import { withTheme } from '../../theme'; import { themes } from '../../constants/colors'; import SafeAreaView from '../../containers/SafeAreaView'; +import styles from './styles'; class ReadReceiptView extends React.Component { static navigationOptions = ({ navigation, isMasterDetail }) => { diff --git a/app/views/ReadReceiptView/styles.js b/app/views/ReadReceiptView/styles.js index 828e814c0..dbf31e6a0 100644 --- a/app/views/ReadReceiptView/styles.js +++ b/app/views/ReadReceiptView/styles.js @@ -1,4 +1,5 @@ import { StyleSheet } from 'react-native'; + import sharedStyles from '../Styles'; export default StyleSheet.create({ diff --git a/app/views/RegisterView.js b/app/views/RegisterView.js index 685f1449a..0d5b03683 100644 --- a/app/views/RegisterView.js +++ b/app/views/RegisterView.js @@ -1,13 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - Text, View, StyleSheet, Keyboard + Keyboard, StyleSheet, Text, View } from 'react-native'; import { connect } from 'react-redux'; import RNPickerSelect from 'react-native-picker-select'; -import log, { logEvent, events } from '../utils/log'; -import sharedStyles from './Styles'; +import log, { events, logEvent } from '../utils/log'; import Button from '../containers/Button'; import I18n from '../i18n'; import * as HeaderButton from '../containers/HeaderButton'; @@ -22,6 +21,7 @@ import { loginRequest as loginRequestAction } from '../actions/login'; import openLink from '../utils/openLink'; import LoginServices from '../containers/LoginServices'; import { getShowLoginButton } from '../selectors/login'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ title: { diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index 914a42913..d7f1f74b9 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, Text, Share, Switch + Share, Switch, Text, View } from 'react-native'; import { connect } from 'react-redux'; import isEmpty from 'lodash/isEmpty'; @@ -11,19 +11,18 @@ import { compareServerVersion, methods } from '../../lib/utils'; import Touch from '../../utils/touch'; import { setLoading as setLoadingAction } from '../../actions/selectedUsers'; import { - leaveRoom as leaveRoomAction, closeRoom as closeRoomAction + closeRoom as closeRoomAction, leaveRoom as leaveRoomAction } from '../../actions/room'; -import styles from './styles'; import sharedStyles from '../Styles'; import Avatar from '../../containers/Avatar'; import Status from '../../containers/Status'; import * as List from '../../containers/List'; import RocketChat from '../../lib/rocketchat'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import RoomTypeIcon from '../../containers/RoomTypeIcon'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; -import { themes, SWITCH_TRACK_COLOR } from '../../constants/colors'; +import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import * as HeaderButton from '../../containers/HeaderButton'; import Markdown from '../../containers/markdown'; @@ -33,6 +32,7 @@ import { E2E_ROOM_TYPES } from '../../lib/encryption/constants'; import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import database from '../../lib/database'; import { withDimensions } from '../../dimensions'; +import styles from './styles'; class RoomActionsView extends React.Component { static navigationOptions = ({ navigation, isMasterDetail }) => { @@ -276,7 +276,7 @@ class RoomActionsView extends React.Component { // This method is executed only in componentDidMount and returns a value // We save the state to read in render - const result = (t === 'c' || t === 'p'); + const result = t === 'c' || t === 'p'; return result; } diff --git a/app/views/RoomActionsView/styles.js b/app/views/RoomActionsView/styles.js index 8a1ac129d..1e8f0b1fd 100644 --- a/app/views/RoomActionsView/styles.js +++ b/app/views/RoomActionsView/styles.js @@ -1,6 +1,6 @@ -import { StyleSheet, I18nManager } from 'react-native'; -import { PADDING_HORIZONTAL } from '../../containers/List/constants'; +import { I18nManager, StyleSheet } from 'react-native'; +import { PADDING_HORIZONTAL } from '../../containers/List/constants'; import sharedStyles from '../Styles'; export default StyleSheet.create({ diff --git a/app/views/RoomInfoEditView/SwitchContainer.js b/app/views/RoomInfoEditView/SwitchContainer.js index de1aed98f..e26f8881c 100644 --- a/app/views/RoomInfoEditView/SwitchContainer.js +++ b/app/views/RoomInfoEditView/SwitchContainer.js @@ -1,9 +1,9 @@ import React from 'react'; -import { View, Text, Switch } from 'react-native'; +import { Switch, Text, View } from 'react-native'; import PropTypes from 'prop-types'; -import styles from './styles'; import { SWITCH_TRACK_COLOR, themes } from '../../constants/colors'; +import styles from './styles'; const SwitchContainer = React.memo(({ children, value, disabled, onValueChange, leftLabelPrimary, leftLabelSecondary, rightLabelPrimary, rightLabelSecondary, theme, testID, labelContainerStyle, leftLabelStyle diff --git a/app/views/RoomInfoEditView/index.js b/app/views/RoomInfoEditView/index.js index 8dd7e0865..2ca8cd0db 100644 --- a/app/views/RoomInfoEditView/index.js +++ b/app/views/RoomInfoEditView/index.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - Text, View, ScrollView, TouchableOpacity, Keyboard, Alert + Alert, Keyboard, ScrollView, Text, TouchableOpacity, View } from 'react-native'; import { connect } from 'react-redux'; import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit'; @@ -15,7 +15,6 @@ import database from '../../lib/database'; import { deleteRoom as deleteRoomAction } from '../../actions/room'; import KeyboardView from '../../presentation/KeyboardView'; import sharedStyles from '../Styles'; -import styles from './styles'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; import { LISTENER } from '../../containers/Toast'; @@ -23,9 +22,8 @@ import EventEmitter from '../../utils/events'; import RocketChat from '../../lib/rocketchat'; import RCTextInput from '../../containers/TextInput'; import Loading from '../../containers/Loading'; -import SwitchContainer from './SwitchContainer'; import random from '../../utils/random'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import I18n from '../../i18n'; import StatusBar from '../../containers/StatusBar'; import { themes } from '../../constants/colors'; @@ -35,6 +33,8 @@ import { MessageTypeValues } from '../../utils/messageTypes'; import SafeAreaView from '../../containers/SafeAreaView'; import Avatar from '../../containers/Avatar'; import { CustomIcon } from '../../lib/Icons'; +import SwitchContainer from './SwitchContainer'; +import styles from './styles'; const PERMISSION_SET_READONLY = 'set-readonly'; const PERMISSION_SET_REACT_WHEN_READONLY = 'set-react-when-readonly'; @@ -129,7 +129,7 @@ class RoomInfoEditView extends React.Component { unarchiveRoomPermission, deleteCPermission, deletePPermission, - ...(this.room.teamMain ? [deleteTeamPermission] : []) + ...this.room.teamMain ? [deleteTeamPermission] : [] ], rid); this.setState({ @@ -140,7 +140,7 @@ class RoomInfoEditView extends React.Component { [PERMISSION_UNARCHIVE]: result[3], [PERMISSION_DELETE_C]: result[4], [PERMISSION_DELETE_P]: result[5], - ...(this.room.teamMain && { [PERMISSION_DELETE_TEAM]: result[6] }) + ...this.room.teamMain && { [PERMISSION_DELETE_TEAM]: result[6] } } }); } catch (e) { diff --git a/app/views/RoomInfoView/Direct.js b/app/views/RoomInfoView/Direct.js index 7587bda6f..14b2a83a4 100644 --- a/app/views/RoomInfoView/Direct.js +++ b/app/views/RoomInfoView/Direct.js @@ -1,13 +1,11 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import PropTypes from 'prop-types'; import { themes } from '../../constants/colors'; import I18n from '../../i18n'; - import Timezone from './Timezone'; import CustomFields from './CustomFields'; - import styles from './styles'; const Roles = ({ roles, theme }) => (roles && roles.length ? ( diff --git a/app/views/RoomInfoView/Item.js b/app/views/RoomInfoView/Item.js index b2503c2e3..e820c5090 100644 --- a/app/views/RoomInfoView/Item.js +++ b/app/views/RoomInfoView/Item.js @@ -1,10 +1,10 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import PropTypes from 'prop-types'; -import styles from './styles'; import Markdown from '../../containers/markdown'; import { themes } from '../../constants/colors'; +import styles from './styles'; const Item = ({ label, content, theme, testID diff --git a/app/views/RoomInfoView/Livechat.js b/app/views/RoomInfoView/Livechat.js index 09e14a608..e6dca73cc 100644 --- a/app/views/RoomInfoView/Livechat.js +++ b/app/views/RoomInfoView/Livechat.js @@ -1,15 +1,15 @@ -import React, { useState, useEffect } from 'react'; -import { Text, StyleSheet } from 'react-native'; +import React, { useEffect, useState } from 'react'; +import { StyleSheet, Text } from 'react-native'; import PropTypes from 'prop-types'; import RocketChat from '../../lib/rocketchat'; import { withTheme } from '../../theme'; -import CustomFields from './CustomFields'; -import Item from './Item'; -import Timezone from './Timezone'; import sharedStyles from '../Styles'; import { themes } from '../../constants/colors'; import I18n from '../../i18n'; +import CustomFields from './CustomFields'; +import Item from './Item'; +import Timezone from './Timezone'; const styles = StyleSheet.create({ title: { diff --git a/app/views/RoomInfoView/index.js b/app/views/RoomInfoView/index.js index a966463bf..c9c3d8e03 100644 --- a/app/views/RoomInfoView/index.js +++ b/app/views/RoomInfoView/index.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, Text, ScrollView } from 'react-native'; +import { ScrollView, Text, View } from 'react-native'; import { BorderlessButton } from 'react-native-gesture-handler'; import { connect } from 'react-redux'; import UAParser from 'ua-parser-js'; @@ -9,26 +9,25 @@ import isEmpty from 'lodash/isEmpty'; import { CustomIcon } from '../../lib/Icons'; import Status from '../../containers/Status'; import Avatar from '../../containers/Avatar'; -import styles from './styles'; import sharedStyles from '../Styles'; import RocketChat from '../../lib/rocketchat'; import RoomTypeIcon from '../../containers/RoomTypeIcon'; import I18n from '../../i18n'; import * as HeaderButton from '../../containers/HeaderButton'; import StatusBar from '../../containers/StatusBar'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import Markdown from '../../containers/markdown'; import { LISTENER } from '../../containers/Toast'; import EventEmitter from '../../utils/events'; - -import Livechat from './Livechat'; -import Channel from './Channel'; -import Direct from './Direct'; import SafeAreaView from '../../containers/SafeAreaView'; import { goRoom } from '../../utils/goRoom'; import Navigation from '../../lib/Navigation'; +import Livechat from './Livechat'; +import Channel from './Channel'; +import Direct from './Direct'; +import styles from './styles'; const getRoomTitle = (room, type, name, username, statusText, theme) => (type === 'd' ? ( diff --git a/app/views/RoomMembersView/index.js b/app/views/RoomMembersView/index.js index aaa0c98f9..eccb3ac1c 100644 --- a/app/views/RoomMembersView/index.js +++ b/app/views/RoomMembersView/index.js @@ -3,9 +3,8 @@ import PropTypes from 'prop-types'; import { FlatList } from 'react-native'; import { connect } from 'react-redux'; import { Q } from '@nozbe/watermelondb'; -import * as List from '../../containers/List'; -import styles from './styles'; +import * as List from '../../containers/List'; import UserItem from '../../presentation/UserItem'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; import RocketChat from '../../lib/rocketchat'; @@ -27,6 +26,7 @@ import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; import SafeAreaView from '../../containers/SafeAreaView'; import { goRoom } from '../../utils/goRoom'; import { CustomIcon } from '../../lib/Icons'; +import styles from './styles'; const PAGE_SIZE = 25; @@ -106,7 +106,7 @@ class RoomMembersView extends React.Component { } = this.props; const result = await RocketChat.hasPermission([ - muteUserPermission, setLeaderPermission, setOwnerPermission, setModeratorPermission, removeUserPermission, ...(room.teamMain ? [editTeamMemberPermission, viewAllTeamChannelsPermission, viewAllTeamsPermission] : []) + muteUserPermission, setLeaderPermission, setOwnerPermission, setModeratorPermission, removeUserPermission, ...room.teamMain ? [editTeamMemberPermission, viewAllTeamChannelsPermission, viewAllTeamsPermission] : [] ], room.rid); this.permissions = { @@ -115,11 +115,11 @@ class RoomMembersView extends React.Component { [PERMISSION_SET_OWNER]: result[2], [PERMISSION_SET_MODERATOR]: result[3], [PERMISSION_REMOVE_USER]: result[4], - ...(room.teamMain ? { + ...room.teamMain ? { [PERMISSION_EDIT_TEAM_MEMBER]: result[5], [PERMISSION_VIEW_ALL_TEAM_CHANNELS]: result[6], [PERMISION_VIEW_ALL_TEAMS]: result[7] - } : {}) + } : {} }; const hasSinglePermission = Object.values(this.permissions).some(p => !!p); @@ -225,7 +225,7 @@ class RoomMembersView extends React.Component { teamId: room.teamId, teamName: room.name, userId, - ...(selected && { rooms: selected }) + ...selected && { rooms: selected } }); if (result.success) { const message = I18n.t('User_has_been_removed_from_s', { s: RocketChat.getRoomTitle(room) }); diff --git a/app/views/RoomView/Banner.js b/app/views/RoomView/Banner.js index 5ee5bb9a2..5172e1311 100644 --- a/app/views/RoomView/Banner.js +++ b/app/views/RoomView/Banner.js @@ -1,11 +1,10 @@ import React, { useState } from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import PropTypes from 'prop-types'; -import { ScrollView, BorderlessButton } from 'react-native-gesture-handler'; +import { BorderlessButton, ScrollView } from 'react-native-gesture-handler'; import Modal from 'react-native-modal'; import Markdown from '../../containers/markdown'; - import { CustomIcon } from '../../lib/Icons'; import { themes } from '../../constants/colors'; import styles from './styles'; diff --git a/app/views/RoomView/JoinCode.js b/app/views/RoomView/JoinCode.js index e3639818b..8ef7c4299 100644 --- a/app/views/RoomView/JoinCode.js +++ b/app/views/RoomView/JoinCode.js @@ -1,14 +1,14 @@ import React, { - useState, forwardRef, - useImperativeHandle + useImperativeHandle, + useState } from 'react'; import PropTypes from 'prop-types'; import { - View, - Text, + InteractionManager, StyleSheet, - InteractionManager + Text, + View } from 'react-native'; import Modal from 'react-native-modal'; import { connect } from 'react-redux'; @@ -18,7 +18,6 @@ import Button from '../../containers/Button'; import TextInput from '../../containers/TextInput'; import RocketChat from '../../lib/rocketchat'; import sharedStyles from '../Styles'; - import { themes } from '../../constants/colors'; const styles = StyleSheet.create({ diff --git a/app/views/RoomView/List/NavBottomFAB.js b/app/views/RoomView/List/NavBottomFAB.js index 481ac79a6..a7e5dd54e 100644 --- a/app/views/RoomView/List/NavBottomFAB.js +++ b/app/views/RoomView/List/NavBottomFAB.js @@ -1,5 +1,5 @@ import React, { useCallback, useState } from 'react'; -import { View, StyleSheet } from 'react-native'; +import { StyleSheet, View } from 'react-native'; import PropTypes from 'prop-types'; import Animated, { call, cond, greaterOrEq, useCode diff --git a/app/views/RoomView/List/index.js b/app/views/RoomView/List/index.js index cbf02879b..6cdf40252 100644 --- a/app/views/RoomView/List/index.js +++ b/app/views/RoomView/List/index.js @@ -13,9 +13,9 @@ import EmptyRoom from '../EmptyRoom'; import { animateNextTransition } from '../../../utils/layoutAnimation'; import ActivityIndicator from '../../../containers/ActivityIndicator'; import { themes } from '../../../constants/colors'; +import debounce from '../../../utils/debounce'; import List from './List'; import NavBottomFAB from './NavBottomFAB'; -import debounce from '../../../utils/debounce'; const QUERY_SIZE = 50; diff --git a/app/views/RoomView/LoadMore/LoadMore.stories.js b/app/views/RoomView/LoadMore/LoadMore.stories.js index 1f110a9cf..a9d5c4605 100644 --- a/app/views/RoomView/LoadMore/LoadMore.stories.js +++ b/app/views/RoomView/LoadMore/LoadMore.stories.js @@ -3,14 +3,14 @@ import React from 'react'; import { ScrollView } from 'react-native'; import { storiesOf } from '@storybook/react-native'; -import LoadMore from './index'; import { longText } from '../../../../storybook/utils'; import { ThemeContext } from '../../../theme'; import { - Message, StoryProvider, MessageDecorator + Message, MessageDecorator, StoryProvider } from '../../../../storybook/stories/Message'; import { themes } from '../../../constants/colors'; import { MESSAGE_TYPE_LOAD_MORE, MESSAGE_TYPE_LOAD_NEXT_CHUNK, MESSAGE_TYPE_LOAD_PREVIOUS_CHUNK } from '../../../constants/messageTypeLoad'; +import LoadMore from './index'; const stories = storiesOf('LoadMore', module); diff --git a/app/views/RoomView/LoadMore/index.js b/app/views/RoomView/LoadMore/index.js index 04b922835..487476f90 100644 --- a/app/views/RoomView/LoadMore/index.js +++ b/app/views/RoomView/LoadMore/index.js @@ -1,5 +1,5 @@ -import React, { useEffect, useCallback, useState } from 'react'; -import { Text, StyleSheet, ActivityIndicator } from 'react-native'; +import React, { useCallback, useEffect, useState } from 'react'; +import { ActivityIndicator, StyleSheet, Text } from 'react-native'; import PropTypes from 'prop-types'; import { themes } from '../../../constants/colors'; diff --git a/app/views/RoomView/ReactionPicker.js b/app/views/RoomView/ReactionPicker.js index 9e9c470f8..052ad2676 100644 --- a/app/views/RoomView/ReactionPicker.js +++ b/app/views/RoomView/ReactionPicker.js @@ -5,10 +5,10 @@ import { connect } from 'react-redux'; import Modal from 'react-native-modal'; import EmojiPicker from '../../containers/EmojiPicker'; -import styles from './styles'; import { isAndroid } from '../../utils/deviceInfo'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; +import styles from './styles'; const margin = isAndroid ? 40 : 20; const maxSize = 400; @@ -52,7 +52,7 @@ class ReactionPicker extends React.Component { heightStyle = maxSize; } - return (show + return show ? ( ) - : null - ); + : null; } } diff --git a/app/views/RoomView/RightButtons.js b/app/views/RoomView/RightButtons.js index 5b283b4ad..07ccc3888 100644 --- a/app/views/RoomView/RightButtons.js +++ b/app/views/RoomView/RightButtons.js @@ -6,7 +6,7 @@ import { dequal } from 'dequal'; import * as HeaderButton from '../../containers/HeaderButton'; import database from '../../lib/database'; import { getUserSelector } from '../../selectors/login'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; import { isTeamRoom } from '../../utils/room'; class RightButtonsContainer extends Component { diff --git a/app/views/RoomView/Separator.js b/app/views/RoomView/Separator.js index c705f1fe5..b992f2560 100644 --- a/app/views/RoomView/Separator.js +++ b/app/views/RoomView/Separator.js @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import moment from 'moment'; diff --git a/app/views/RoomView/UploadProgress.js b/app/views/RoomView/UploadProgress.js index ab17efc8b..f9887a01e 100644 --- a/app/views/RoomView/UploadProgress.js +++ b/app/views/RoomView/UploadProgress.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { - View, Text, StyleSheet, TouchableOpacity, ScrollView + ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import PropTypes from 'prop-types'; import { Q } from '@nozbe/watermelondb'; diff --git a/app/views/RoomView/index.js b/app/views/RoomView/index.js index 13de89c87..eeb66cecd 100644 --- a/app/views/RoomView/index.js +++ b/app/views/RoomView/index.js @@ -1,9 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Text, View, InteractionManager } from 'react-native'; +import { InteractionManager, Text, View } from 'react-native'; import { connect } from 'react-redux'; import parse from 'url-parse'; - import moment from 'moment'; import * as Haptics from 'expo-haptics'; import { Q } from '@nozbe/watermelondb'; @@ -14,32 +13,24 @@ import Touch from '../../utils/touch'; import { replyBroadcast as replyBroadcastAction } from '../../actions/messages'; -import List from './List'; import database from '../../lib/database'; import RocketChat from '../../lib/rocketchat'; import Message from '../../containers/message'; import MessageActions from '../../containers/MessageActions'; import MessageErrorActions from '../../containers/MessageErrorActions'; import MessageBox from '../../containers/MessageBox'; -import ReactionPicker from './ReactionPicker'; -import UploadProgress from './UploadProgress'; -import JoinCode from './JoinCode'; -import styles from './styles'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import EventEmitter from '../../utils/events'; import I18n from '../../i18n'; import RoomHeader from '../../containers/RoomHeader'; -import LeftButtons from './LeftButtons'; -import RightButtons from './RightButtons'; import StatusBar from '../../containers/StatusBar'; -import Separator from './Separator'; import { themes } from '../../constants/colors'; import { MESSAGE_TYPE_ANY_LOAD, MESSAGE_TYPE_LOAD_MORE } from '../../constants/messageTypeLoad'; import debounce from '../../utils/debounce'; import ReactionsModal from '../../containers/ReactionsModal'; import { LISTENER } from '../../containers/Toast'; import { - getBadgeColor, isBlocked, makeThreadName, isTeamRoom + getBadgeColor, isBlocked, isTeamRoom, makeThreadName } from '../../utils/room'; import { isReadOnly } from '../../utils/isReadOnly'; import { isIOS, isTablet } from '../../utils/deviceInfo'; @@ -47,29 +38,36 @@ import { showErrorAlert } from '../../utils/info'; import { withTheme } from '../../theme'; import { KEY_COMMAND, - handleCommandScroll, + handleCommandReplyLatest, handleCommandRoomActions, - handleCommandSearchMessages, - handleCommandReplyLatest + handleCommandScroll, + handleCommandSearchMessages } from '../../commands'; import { Review } from '../../utils/review'; import RoomClass from '../../lib/methods/subscriptions/room'; import { getUserSelector } from '../../selectors/login'; import { CONTAINER_TYPES } from '../../lib/methods/actions'; -import Banner from './Banner'; import Navigation from '../../lib/Navigation'; import SafeAreaView from '../../containers/SafeAreaView'; import { withDimensions } from '../../dimensions'; import { getHeaderTitlePosition } from '../../containers/Header'; import { E2E_MESSAGE_TYPE, E2E_STATUS } from '../../lib/encryption/constants'; - import { takeInquiry } from '../../ee/omnichannel/lib'; import Loading from '../../containers/Loading'; -import LoadMore from './LoadMore'; -import RoomServices from './services'; import { goRoom } from '../../utils/goRoom'; import getThreadName from '../../lib/methods/getThreadName'; import getRoomInfo from '../../lib/methods/getRoomInfo'; +import RoomServices from './services'; +import LoadMore from './LoadMore'; +import Banner from './Banner'; +import Separator from './Separator'; +import RightButtons from './RightButtons'; +import LeftButtons from './LeftButtons'; +import styles from './styles'; +import JoinCode from './JoinCode'; +import UploadProgress from './UploadProgress'; +import ReactionPicker from './ReactionPicker'; +import List from './List'; const stateAttrsUpdate = [ 'joined', diff --git a/app/views/RoomsListView/Header/Header.js b/app/views/RoomsListView/Header/Header.js index 43fa4b83a..d6a67dc9e 100644 --- a/app/views/RoomsListView/Header/Header.js +++ b/app/views/RoomsListView/Header/Header.js @@ -1,6 +1,6 @@ import React from 'react'; import { - Text, View, TouchableOpacity, StyleSheet + StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import PropTypes from 'prop-types'; @@ -9,7 +9,7 @@ import I18n from '../../../i18n'; import sharedStyles from '../../Styles'; import { themes } from '../../../constants/colors'; import { CustomIcon } from '../../../lib/Icons'; -import { isTablet, isIOS } from '../../../utils/deviceInfo'; +import { isIOS, isTablet } from '../../../utils/deviceInfo'; import { useOrientation } from '../../../dimensions'; const styles = StyleSheet.create({ diff --git a/app/views/RoomsListView/Header/index.js b/app/views/RoomsListView/Header/index.js index 97244fd5b..25c1705c6 100644 --- a/app/views/RoomsListView/Header/index.js +++ b/app/views/RoomsListView/Header/index.js @@ -3,14 +3,14 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { - toggleServerDropdown, closeServerDropdown, closeSortDropdown, setSearch as setSearchAction + closeServerDropdown, closeSortDropdown, setSearch as setSearchAction, toggleServerDropdown } from '../../../actions/rooms'; -import Header from './Header'; import { withTheme } from '../../../theme'; import EventEmitter from '../../../utils/events'; import { KEY_COMMAND, handleCommandOpenServerDropdown } from '../../../commands'; import { isTablet } from '../../../utils/deviceInfo'; -import { logEvent, events } from '../../../utils/log'; +import { events, logEvent } from '../../../utils/log'; +import Header from './Header'; class RoomsListHeaderView extends PureComponent { static propTypes = { diff --git a/app/views/RoomsListView/ListHeader/index.js b/app/views/RoomsListView/ListHeader/index.js index 85ffcfa9c..10272c6cb 100644 --- a/app/views/RoomsListView/ListHeader/index.js +++ b/app/views/RoomsListView/ListHeader/index.js @@ -6,7 +6,6 @@ import I18n from '../../../i18n'; import * as List from '../../../containers/List'; import { E2E_BANNER_TYPE } from '../../../lib/encryption/constants'; import { themes } from '../../../constants/colors'; - import OmnichannelStatus from '../../../ee/omnichannel/containers/OmnichannelStatus'; const ListHeader = React.memo(({ diff --git a/app/views/RoomsListView/ServerDropdown.js b/app/views/RoomsListView/ServerDropdown.js index c27691aff..dc4ab8a29 100644 --- a/app/views/RoomsListView/ServerDropdown.js +++ b/app/views/RoomsListView/ServerDropdown.js @@ -1,16 +1,15 @@ import React, { Component } from 'react'; import { - View, Text, Animated, Easing, TouchableWithoutFeedback, TouchableOpacity, FlatList + Animated, Easing, FlatList, Text, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native'; import PropTypes from 'prop-types'; -import { connect, batch } from 'react-redux'; +import { batch, connect } from 'react-redux'; import { withSafeAreaInsets } from 'react-native-safe-area-context'; -import * as List from '../../containers/List'; +import * as List from '../../containers/List'; import { toggleServerDropdown as toggleServerDropdownAction } from '../../actions/rooms'; import { selectServerRequest as selectServerRequestAction, serverInitAdd as serverInitAddAction } from '../../actions/server'; -import { appStart as appStartAction, ROOT_NEW_SERVER } from '../../actions/app'; -import styles from './styles'; +import { ROOT_NEW_SERVER, appStart as appStartAction } from '../../actions/app'; import RocketChat from '../../lib/rocketchat'; import I18n from '../../i18n'; import EventEmitter from '../../utils/events'; @@ -22,10 +21,11 @@ import { KEY_COMMAND, handleCommandSelectServer } from '../../commands'; import { isTablet } from '../../utils/deviceInfo'; import { localAuthenticate } from '../../utils/localAuthentication'; import { showConfirmationAlert } from '../../utils/info'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; import { headerHeight } from '../../containers/Header'; import { goRoom } from '../../utils/goRoom'; import UserPreferences from '../../lib/userPreferences'; +import styles from './styles'; const ROW_HEIGHT = 68; const ANIMATION_DURATION = 200; @@ -182,7 +182,7 @@ class ServerDropdown extends Component { this.select(item.id, item.version)} - onLongPress={() => (item.id === server || this.remove(item.id))} + onLongPress={() => item.id === server || this.remove(item.id)} hasCheck={item.id === server} theme={theme} /> diff --git a/app/views/RoomsListView/SortDropdown/index.js b/app/views/RoomsListView/SortDropdown/index.js index 06a398a82..b81c53f0d 100644 --- a/app/views/RoomsListView/SortDropdown/index.js +++ b/app/views/RoomsListView/SortDropdown/index.js @@ -10,7 +10,7 @@ import styles from '../styles'; import * as List from '../../../containers/List'; import RocketChat from '../../../lib/rocketchat'; import { setPreference } from '../../../actions/sortPreferences'; -import log, { logEvent, events } from '../../../utils/log'; +import log, { events, logEvent } from '../../../utils/log'; import I18n from '../../../i18n'; import { withTheme } from '../../../theme'; import { themes } from '../../../constants/colors'; diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index 214f213e4..bd3d080a1 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -1,12 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, - FlatList, BackHandler, - Text, + FlatList, Keyboard, - RefreshControl + RefreshControl, + Text, + View } from 'react-native'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; @@ -17,25 +17,20 @@ import { withSafeAreaInsets } from 'react-native-safe-area-context'; import database from '../../lib/database'; import RocketChat from '../../lib/rocketchat'; import RoomItem, { ROW_HEIGHT } from '../../presentation/RoomItem'; -import styles from './styles'; -import log, { logEvent, events } from '../../utils/log'; +import log, { events, logEvent } from '../../utils/log'; import I18n from '../../i18n'; -import SortDropdown from './SortDropdown'; -import ServerDropdown from './ServerDropdown'; import { - toggleSortDropdown as toggleSortDropdownAction, - openSearchHeader as openSearchHeaderAction, closeSearchHeader as closeSearchHeaderAction, + closeServerDropdown as closeServerDropdownAction, + openSearchHeader as openSearchHeaderAction, roomsRequest as roomsRequestAction, - closeServerDropdown as closeServerDropdownAction + toggleSortDropdown as toggleSortDropdownAction } from '../../actions/rooms'; import debounce from '../../utils/debounce'; import { isIOS, isTablet } from '../../utils/deviceInfo'; -import RoomsListHeaderView from './Header'; import * as HeaderButton from '../../containers/HeaderButton'; import StatusBar from '../../containers/StatusBar'; import ActivityIndicator from '../../containers/ActivityIndicator'; -import ListHeader from './ListHeader'; import { selectServerRequest as selectServerRequestAction } from '../../actions/server'; import { animateNextTransition } from '../../utils/layoutAnimation'; import { withTheme } from '../../theme'; @@ -43,13 +38,13 @@ import { themes } from '../../constants/colors'; import EventEmitter from '../../utils/events'; import { KEY_COMMAND, - handleCommandShowPreferences, + handleCommandAddNewServer, + handleCommandNextRoom, + handleCommandPreviousRoom, handleCommandSearching, handleCommandSelectRoom, - handleCommandPreviousRoom, - handleCommandNextRoom, handleCommandShowNewMessage, - handleCommandAddNewServer + handleCommandShowPreferences } from '../../commands'; import { MAX_SIDEBAR_WIDTH } from '../../constants/tablet'; import { getUserSelector } from '../../selectors/login'; @@ -57,11 +52,15 @@ import { goRoom } from '../../utils/goRoom'; import SafeAreaView from '../../containers/SafeAreaView'; import Header, { getHeaderTitlePosition } from '../../containers/Header'; import { withDimensions } from '../../dimensions'; -import { showErrorAlert, showConfirmationAlert } from '../../utils/info'; +import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; import { E2E_BANNER_TYPE } from '../../lib/encryption/constants'; - import { getInquiryQueueSelector } from '../../ee/omnichannel/selectors/inquiry'; import { changeLivechatStatus, isOmnichannelStatusAvailable } from '../../ee/omnichannel/lib'; +import ListHeader from './ListHeader'; +import RoomsListHeaderView from './Header'; +import ServerDropdown from './ServerDropdown'; +import SortDropdown from './SortDropdown'; +import styles from './styles'; const INITIAL_NUM_TO_RENDER = isTablet ? 20 : 12; const CHATS_HEADER = 'Chats'; @@ -849,7 +848,7 @@ class RoomsListView extends React.Component { } } - getScrollRef = ref => (this.scroll = ref); + getScrollRef = ref => this.scroll = ref; renderListHeader = () => { const { searching } = this.state; diff --git a/app/views/ScreenLockConfigView.js b/app/views/ScreenLockConfigView.js index 294a854a6..0dbca21cc 100644 --- a/app/views/ScreenLockConfigView.js +++ b/app/views/ScreenLockConfigView.js @@ -5,11 +5,11 @@ import { connect } from 'react-redux'; import I18n from '../i18n'; import { withTheme } from '../theme'; -import { themes, SWITCH_TRACK_COLOR } from '../constants/colors'; +import { SWITCH_TRACK_COLOR, themes } from '../constants/colors'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; import database from '../lib/database'; -import { supportedBiometryLabel, changePasscode, checkHasPasscode } from '../utils/localAuthentication'; +import { changePasscode, checkHasPasscode, supportedBiometryLabel } from '../utils/localAuthentication'; import { DEFAULT_AUTO_LOCK } from '../constants/localAuthentication'; import SafeAreaView from '../containers/SafeAreaView'; import { events, logEvent } from '../utils/log'; diff --git a/app/views/ScreenLockedView.js b/app/views/ScreenLockedView.js index 2b036779c..4de05727c 100644 --- a/app/views/ScreenLockedView.js +++ b/app/views/ScreenLockedView.js @@ -32,12 +32,12 @@ const ScreenLockedView = ({ theme }) => { Orientation.lockToPortrait(); } const listener = EventEmitter.addEventListener(LOCAL_AUTHENTICATE_EMITTER, showScreenLock); - return (() => { + return () => { if (!isTablet) { Orientation.unlockAllOrientations(); } EventEmitter.removeListener(LOCAL_AUTHENTICATE_EMITTER, listener); - }); + }; }, []); const onSubmit = () => { diff --git a/app/views/SearchMessagesView/index.js b/app/views/SearchMessagesView/index.js index 09c9e6c15..19c8a9164 100644 --- a/app/views/SearchMessagesView/index.js +++ b/app/views/SearchMessagesView/index.js @@ -1,13 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, FlatList, Text } from 'react-native'; +import { FlatList, Text, View } from 'react-native'; import { Q } from '@nozbe/watermelondb'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; import RCTextInput from '../../containers/TextInput'; import ActivityIndicator from '../../containers/ActivityIndicator'; -import styles from './styles'; import Markdown from '../../containers/markdown'; import debounce from '../../utils/debounce'; import RocketChat from '../../lib/rocketchat'; @@ -25,6 +24,7 @@ import database from '../../lib/database'; import { sanitizeLikeString } from '../../lib/database/utils'; import getThreadName from '../../lib/methods/getThreadName'; import getRoomInfo from '../../lib/methods/getRoomInfo'; +import styles from './styles'; class SearchMessagesView extends React.Component { static navigationOptions = ({ navigation, route }) => { diff --git a/app/views/SecurityPrivacyView.js b/app/views/SecurityPrivacyView.js index 937a02504..c0cbb6319 100644 --- a/app/views/SecurityPrivacyView.js +++ b/app/views/SecurityPrivacyView.js @@ -4,14 +4,14 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import AsyncStorage from '@react-native-community/async-storage'; -import { toggleCrashReport as toggleCrashReportAction, toggleAnalyticsEvents as toggleAnalyticsEventsAction } from '../actions/crashReport'; +import { toggleAnalyticsEvents as toggleAnalyticsEventsAction, toggleCrashReport as toggleCrashReportAction } from '../actions/crashReport'; import { SWITCH_TRACK_COLOR } from '../constants/colors'; import StatusBar from '../containers/StatusBar'; import * as List from '../containers/List'; import I18n from '../i18n'; -import { CRASH_REPORT_KEY, ANALYTICS_EVENTS_KEY } from '../lib/rocketchat'; +import { ANALYTICS_EVENTS_KEY, CRASH_REPORT_KEY } from '../lib/rocketchat'; import { - loggerConfig, analytics, logEvent, events + analytics, events, logEvent, loggerConfig } from '../utils/log'; import SafeAreaView from '../containers/SafeAreaView'; import { isFDroidBuild } from '../constants/environment'; diff --git a/app/views/SelectListView.js b/app/views/SelectListView.js index 5767df3f2..902059d19 100644 --- a/app/views/SelectListView.js +++ b/app/views/SelectListView.js @@ -1,14 +1,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, StyleSheet, FlatList, Text + FlatList, StyleSheet, Text, View } from 'react-native'; import { connect } from 'react-redux'; import { RadioButton } from 'react-native-ui-lib'; import log from '../utils/log'; import * as List from '../containers/List'; -import sharedStyles from './Styles'; import I18n from '../i18n'; import * as HeaderButton from '../containers/HeaderButton'; import StatusBar from '../containers/StatusBar'; @@ -18,6 +17,7 @@ import SafeAreaView from '../containers/SafeAreaView'; import { animateNextTransition } from '../utils/layoutAnimation'; import { ICON_SIZE } from '../containers/List/constants'; import SearchBox from '../containers/SearchBox'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ diff --git a/app/views/SelectServerView.js b/app/views/SelectServerView.js index b3345c820..dbc308794 100644 --- a/app/views/SelectServerView.js +++ b/app/views/SelectServerView.js @@ -79,8 +79,8 @@ class SelectServerView extends React.Component { } } -const mapStateToProps = (({ share }) => ({ +const mapStateToProps = ({ share }) => ({ server: share.server.server -})); +}); export default connect(mapStateToProps)(SelectServerView); diff --git a/app/views/SelectedUsersView.js b/app/views/SelectedUsersView.js index bd6740e1f..9e8529725 100644 --- a/app/views/SelectedUsersView.js +++ b/app/views/SelectedUsersView.js @@ -1,31 +1,31 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, FlatList } from 'react-native'; +import { FlatList, View } from 'react-native'; import { connect } from 'react-redux'; import orderBy from 'lodash/orderBy'; import { Q } from '@nozbe/watermelondb'; -import * as List from '../containers/List'; +import * as List from '../containers/List'; import database from '../lib/database'; import RocketChat from '../lib/rocketchat'; import UserItem from '../presentation/UserItem'; import Loading from '../containers/Loading'; import I18n from '../i18n'; -import log, { logEvent, events } from '../utils/log'; +import log, { events, logEvent } from '../utils/log'; import SearchBox from '../containers/SearchBox'; -import sharedStyles from './Styles'; import * as HeaderButton from '../containers/HeaderButton'; import StatusBar from '../containers/StatusBar'; import { themes } from '../constants/colors'; import { withTheme } from '../theme'; import { getUserSelector } from '../selectors/login'; import { - reset as resetAction, addUser as addUserAction, - removeUser as removeUserAction + removeUser as removeUserAction, + reset as resetAction } from '../actions/selectedUsers'; import { showErrorAlert } from '../utils/info'; import SafeAreaView from '../containers/SafeAreaView'; +import sharedStyles from './Styles'; const ITEM_WIDTH = 250; const getItemLayout = (_, index) => ({ length: ITEM_WIDTH, offset: ITEM_WIDTH * index, index }); @@ -92,13 +92,13 @@ class SelectedUsersView extends React.Component { const nextAction = route.params?.nextAction ?? (() => {}); const options = { title, - headerRight: () => ( + headerRight: () => (!maxUsers || showButton) && ( ) - ) + }; navigation.setOptions(options); } diff --git a/app/views/SetUsernameView.js b/app/views/SetUsernameView.js index ccae5d036..15393472a 100644 --- a/app/views/SetUsernameView.js +++ b/app/views/SetUsernameView.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - Text, ScrollView, StyleSheet + ScrollView, StyleSheet, Text } from 'react-native'; import { connect } from 'react-redux'; import Orientation from 'react-native-orientation-locker'; @@ -10,7 +10,6 @@ import { loginRequest as loginRequestAction } from '../actions/login'; import TextInput from '../containers/TextInput'; import Button from '../containers/Button'; import KeyboardView from '../presentation/KeyboardView'; -import sharedStyles from './Styles'; import scrollPersistTaps from '../utils/scrollPersistTaps'; import I18n from '../i18n'; import RocketChat from '../lib/rocketchat'; @@ -21,6 +20,7 @@ import { isTablet } from '../utils/deviceInfo'; import { getUserSelector } from '../selectors/login'; import { showErrorAlert } from '../utils/info'; import SafeAreaView from '../containers/SafeAreaView'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ loginTitle: { diff --git a/app/views/SettingsView/index.js b/app/views/SettingsView/index.js index 0e8ed7b47..0df968e5f 100644 --- a/app/views/SettingsView/index.js +++ b/app/views/SettingsView/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { - Linking, Share, Clipboard + Clipboard, Linking, Share } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; @@ -16,19 +16,19 @@ import * as List from '../../containers/List'; import I18n from '../../i18n'; import RocketChat from '../../lib/rocketchat'; import { - getReadableVersion, getDeviceModel, isAndroid + getDeviceModel, getReadableVersion, isAndroid } from '../../utils/deviceInfo'; import openLink from '../../utils/openLink'; -import { showErrorAlert, showConfirmationAlert } from '../../utils/info'; -import { logEvent, events } from '../../utils/log'; +import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; +import { events, logEvent } from '../../utils/log'; import { - PLAY_MARKET_LINK, FDROID_MARKET_LINK, APP_STORE_LINK, LICENSE_LINK + APP_STORE_LINK, FDROID_MARKET_LINK, LICENSE_LINK, PLAY_MARKET_LINK } from '../../constants/links'; import { withTheme } from '../../theme'; import SidebarView from '../SidebarView'; import { LISTENER } from '../../containers/Toast'; import EventEmitter from '../../utils/events'; -import { appStart as appStartAction, ROOT_LOADING } from '../../actions/app'; +import { ROOT_LOADING, appStart as appStartAction } from '../../actions/app'; import { onReviewPress } from '../../utils/review'; import SafeAreaView from '../../containers/SafeAreaView'; import database from '../../lib/database'; diff --git a/app/views/ShareListView/Header/Header.android.js b/app/views/ShareListView/Header/Header.android.js index a7fcd0351..727fa5364 100644 --- a/app/views/ShareListView/Header/Header.android.js +++ b/app/views/ShareListView/Header/Header.android.js @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import TextInput from '../../../presentation/TextInput'; diff --git a/app/views/ShareListView/Header/Header.ios.js b/app/views/ShareListView/Header/Header.ios.js index afbe15663..5d4b0a845 100644 --- a/app/views/ShareListView/Header/Header.ios.js +++ b/app/views/ShareListView/Header/Header.ios.js @@ -1,12 +1,11 @@ import React, { useState } from 'react'; import PropTypes from 'prop-types'; -import { Keyboard, View, StyleSheet } from 'react-native'; +import { Keyboard, StyleSheet, View } from 'react-native'; import ShareExtension from 'rn-extensions-share'; import SearchBox from '../../../containers/SearchBox'; import * as HeaderButton from '../../../containers/HeaderButton'; import { themes } from '../../../constants/colors'; - import sharedStyles from '../../Styles'; import { animateNextTransition } from '../../../utils/layoutAnimation'; diff --git a/app/views/ShareListView/index.js b/app/views/ShareListView/index.js index 38f3aff72..ed7a2c9f9 100644 --- a/app/views/ShareListView/index.js +++ b/app/views/ShareListView/index.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - View, Text, FlatList, Keyboard, BackHandler, PermissionsAndroid, ScrollView + BackHandler, FlatList, Keyboard, PermissionsAndroid, ScrollView, Text, View } from 'react-native'; import ShareExtension from 'rn-extensions-share'; import * as FileSystem from 'expo-file-system'; @@ -11,21 +11,21 @@ import { dequal } from 'dequal'; import { Q } from '@nozbe/watermelondb'; import database from '../../lib/database'; -import { isIOS, isAndroid } from '../../utils/deviceInfo'; +import { isAndroid, isIOS } from '../../utils/deviceInfo'; import I18n from '../../i18n'; import DirectoryItem, { ROW_HEIGHT } from '../../presentation/DirectoryItem'; import ServerItem from '../../presentation/ServerItem'; import * as HeaderButton from '../../containers/HeaderButton'; -import ShareListHeader from './Header'; import ActivityIndicator from '../../containers/ActivityIndicator'; import * as List from '../../containers/List'; -import styles from './styles'; import { themes } from '../../constants/colors'; import { animateNextTransition } from '../../utils/layoutAnimation'; import { withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; import RocketChat from '../../lib/rocketchat'; import { sanitizeLikeString } from '../../lib/database/utils'; +import styles from './styles'; +import ShareListHeader from './Header'; const permission = { title: I18n.t('Read_External_Permission'), @@ -452,10 +452,10 @@ class ShareListView extends React.Component { } } -const mapStateToProps = (({ share }) => ({ +const mapStateToProps = ({ share }) => ({ userId: share.user && share.user.id, token: share.user && share.user.token, server: share.server.server -})); +}); export default connect(mapStateToProps)(withTheme(ShareListView)); diff --git a/app/views/ShareListView/styles.js b/app/views/ShareListView/styles.js index 5f5687dc7..2c08ee9f9 100644 --- a/app/views/ShareListView/styles.js +++ b/app/views/ShareListView/styles.js @@ -1,4 +1,5 @@ import { StyleSheet } from 'react-native'; + import { isIOS } from '../../utils/deviceInfo'; import sharedStyles from '../Styles'; diff --git a/app/views/ShareView/Header.js b/app/views/ShareView/Header.js index 85ef08784..fc02a1f70 100644 --- a/app/views/ShareView/Header.js +++ b/app/views/ShareView/Header.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import I18n from '../../i18n'; import { CustomIcon } from '../../lib/Icons'; diff --git a/app/views/ShareView/Preview.js b/app/views/ShareView/Preview.js index 639f41c4c..47e9854a0 100644 --- a/app/views/ShareView/Preview.js +++ b/app/views/ShareView/Preview.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Video } from 'expo-av'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; -import { ScrollView, Text, StyleSheet } from 'react-native'; +import { ScrollView, StyleSheet, Text } from 'react-native'; import prettyBytes from 'pretty-bytes'; import { CustomIcon } from '../../lib/Icons'; @@ -10,11 +10,11 @@ import { ImageViewer, types } from '../../presentation/ImageViewer'; import { themes } from '../../constants/colors'; import { useDimensions, useOrientation } from '../../dimensions'; import { getHeaderHeight } from '../../containers/Header'; -import { THUMBS_HEIGHT } from './constants'; import sharedStyles from '../Styles'; -import { allowPreview } from './utils'; import I18n from '../../i18n'; import { isAndroid } from '../../utils/deviceInfo'; +import { allowPreview } from './utils'; +import { THUMBS_HEIGHT } from './constants'; const MESSAGEBOX_HEIGHT = 56; @@ -60,7 +60,7 @@ const Preview = React.memo(({ const { isLandscape } = useOrientation(); const insets = useSafeAreaInsets(); const headerHeight = getHeaderHeight(isLandscape); - const thumbsHeight = (length > 1) ? THUMBS_HEIGHT : 0; + const thumbsHeight = length > 1 ? THUMBS_HEIGHT : 0; const calculatedHeight = height - insets.top - insets.bottom - MESSAGEBOX_HEIGHT - thumbsHeight - headerHeight; if (item?.canUpload) { diff --git a/app/views/ShareView/Thumbs.js b/app/views/ShareView/Thumbs.js index 26bc54fb4..d5e5bfb00 100644 --- a/app/views/ShareView/Thumbs.js +++ b/app/views/ShareView/Thumbs.js @@ -1,9 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - FlatList, Image, View, StyleSheet + FlatList, Image, StyleSheet, View } from 'react-native'; -import { RectButton, TouchableOpacity, TouchableNativeFeedback } from 'react-native-gesture-handler'; +import { RectButton, TouchableNativeFeedback, TouchableOpacity } from 'react-native-gesture-handler'; import { BUTTON_HIT_SLOP } from '../../containers/message/utils'; import { themes } from '../../constants/colors'; diff --git a/app/views/ShareView/index.js b/app/views/ShareView/index.js index 765860036..d97ccc34d 100644 --- a/app/views/ShareView/index.js +++ b/app/views/ShareView/index.js @@ -1,22 +1,18 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { View, Text, NativeModules } from 'react-native'; +import { NativeModules, Text, View } from 'react-native'; import { connect } from 'react-redux'; import ShareExtension from 'rn-extensions-share'; import { themes } from '../../constants/colors'; import I18n from '../../i18n'; -import styles from './styles'; import Loading from '../../containers/Loading'; import * as HeaderButton from '../../containers/HeaderButton'; import { isBlocked } from '../../utils/room'; import { isReadOnly } from '../../utils/isReadOnly'; import { withTheme } from '../../theme'; -import Header from './Header'; import RocketChat from '../../lib/rocketchat'; import TextInput from '../../containers/TextInput'; -import Preview from './Preview'; -import Thumbs from './Thumbs'; import MessageBox from '../../containers/MessageBox'; import SafeAreaView from '../../containers/SafeAreaView'; import { getUserSelector } from '../../selectors/login'; @@ -24,6 +20,10 @@ import StatusBar from '../../containers/StatusBar'; import database from '../../lib/database'; import { canUploadFile } from '../../utils/media'; import { isAndroid } from '../../utils/deviceInfo'; +import Thumbs from './Thumbs'; +import Preview from './Preview'; +import Header from './Header'; +import styles from './styles'; class ShareView extends Component { constructor(props) { diff --git a/app/views/SidebarView/SidebarItem.js b/app/views/SidebarView/SidebarItem.js index 7959438c2..251012ace 100644 --- a/app/views/SidebarView/SidebarItem.js +++ b/app/views/SidebarView/SidebarItem.js @@ -1,11 +1,11 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import PropTypes from 'prop-types'; -import styles from './styles'; import Touch from '../../utils/touch'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; +import styles from './styles'; const Item = React.memo(({ left, right, text, onPress, testID, current, theme diff --git a/app/views/SidebarView/index.js b/app/views/SidebarView/index.js index 5bb465fd0..385301712 100644 --- a/app/views/SidebarView/index.js +++ b/app/views/SidebarView/index.js @@ -1,23 +1,24 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { - ScrollView, Text, View, TouchableWithoutFeedback + ScrollView, Text, TouchableWithoutFeedback, View } from 'react-native'; import { connect } from 'react-redux'; import { dequal } from 'dequal'; + import Avatar from '../../containers/Avatar'; import Status from '../../containers/Status/Status'; -import { logEvent, events } from '../../utils/log'; +import { events, logEvent } from '../../utils/log'; import I18n from '../../i18n'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; import { CustomIcon } from '../../lib/Icons'; -import styles from './styles'; -import SidebarItem from './SidebarItem'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import { getUserSelector } from '../../selectors/login'; import SafeAreaView from '../../containers/SafeAreaView'; import Navigation from '../../lib/Navigation'; +import SidebarItem from './SidebarItem'; +import styles from './styles'; const Separator = React.memo(({ theme }) => ); Separator.propTypes = { diff --git a/app/views/StatusView.js b/app/views/StatusView.js index 2ac358343..cf5e36574 100644 --- a/app/views/StatusView.js +++ b/app/views/StatusView.js @@ -11,8 +11,7 @@ import EventEmitter from '../utils/events'; import { showErrorAlert } from '../utils/info'; import Loading from '../containers/Loading'; import RocketChat from '../lib/rocketchat'; -import log, { logEvent, events } from '../utils/log'; - +import log, { events, logEvent } from '../utils/log'; import { LISTENER } from '../containers/Toast'; import { withTheme } from '../theme'; import { getUserSelector } from '../selectors/login'; diff --git a/app/views/Styles.js b/app/views/Styles.js index f457a8ed3..89b036741 100644 --- a/app/views/Styles.js +++ b/app/views/Styles.js @@ -1,4 +1,4 @@ -import { StyleSheet, Platform } from 'react-native'; +import { Platform, StyleSheet } from 'react-native'; import { MAX_SCREEN_CONTENT_WIDTH } from '../constants/tablet'; diff --git a/app/views/TeamChannelsView.js b/app/views/TeamChannelsView.js index 64822aeae..bcd9a6af0 100644 --- a/app/views/TeamChannelsView.js +++ b/app/views/TeamChannelsView.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Keyboard, Alert, FlatList } from 'react-native'; +import { Alert, FlatList, Keyboard } from 'react-native'; import PropTypes from 'prop-types'; import { Q } from '@nozbe/watermelondb'; import { withSafeAreaInsets } from 'react-native-safe-area-context'; @@ -8,7 +8,6 @@ import { connect } from 'react-redux'; import StatusBar from '../containers/StatusBar'; import RoomHeader from '../containers/RoomHeader'; import { withTheme } from '../theme'; -import SearchHeader from './ThreadMessagesView/SearchHeader'; import log, { events, logEvent } from '../utils/log'; import database from '../lib/database'; import { getUserSelector } from '../selectors/login'; @@ -29,6 +28,7 @@ import { withActionSheet } from '../containers/ActionSheet'; import { deleteRoom as deleteRoomAction } from '../actions/room'; import { CustomIcon } from '../lib/Icons'; import { themes } from '../constants/colors'; +import SearchHeader from './ThreadMessagesView/SearchHeader'; const API_FETCH_COUNT = 25; const PERMISSION_DELETE_C = 'delete-c'; diff --git a/app/views/ThreadMessagesView/Dropdown/DropdownItem.js b/app/views/ThreadMessagesView/Dropdown/DropdownItem.js index 4ebca9168..43af6895f 100644 --- a/app/views/ThreadMessagesView/Dropdown/DropdownItem.js +++ b/app/views/ThreadMessagesView/Dropdown/DropdownItem.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import { themes } from '../../../constants/colors'; import { withTheme } from '../../../theme'; diff --git a/app/views/ThreadMessagesView/Dropdown/DropdownItemFilter.js b/app/views/ThreadMessagesView/Dropdown/DropdownItemFilter.js index cab41d226..b6b5c45fb 100644 --- a/app/views/ThreadMessagesView/Dropdown/DropdownItemFilter.js +++ b/app/views/ThreadMessagesView/Dropdown/DropdownItemFilter.js @@ -1,8 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; -import DropdownItem from './DropdownItem'; import I18n from '../../../i18n'; +import DropdownItem from './DropdownItem'; const DropdownItemFilter = ({ currentFilter, value, onPress }) => ( { let text; diff --git a/app/views/ThreadMessagesView/Item.js b/app/views/ThreadMessagesView/Item.js index 89ae95cc6..f586d3241 100644 --- a/app/views/ThreadMessagesView/Item.js +++ b/app/views/ThreadMessagesView/Item.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import Touchable from 'react-native-platform-touchable'; import { withTheme } from '../../theme'; diff --git a/app/views/ThreadMessagesView/Item.stories.js b/app/views/ThreadMessagesView/Item.stories.js index be8f398ef..8a926b22b 100644 --- a/app/views/ThreadMessagesView/Item.stories.js +++ b/app/views/ThreadMessagesView/Item.stories.js @@ -5,10 +5,10 @@ import { ScrollView } from 'react-native'; import { combineReducers, createStore } from 'redux'; import { Provider } from 'react-redux'; -import Item from './Item'; import * as List from '../../containers/List'; import { themes } from '../../constants/colors'; import { ThemeContext } from '../../theme'; +import Item from './Item'; const author = { _id: 'userid', diff --git a/app/views/ThreadMessagesView/SearchHeader.js b/app/views/ThreadMessagesView/SearchHeader.js index ae8c96e84..3bd9c8540 100644 --- a/app/views/ThreadMessagesView/SearchHeader.js +++ b/app/views/ThreadMessagesView/SearchHeader.js @@ -6,7 +6,7 @@ import { withTheme } from '../../theme'; import sharedStyles from '../Styles'; import { themes } from '../../constants/colors'; import TextInput from '../../presentation/TextInput'; -import { isTablet, isIOS } from '../../utils/deviceInfo'; +import { isIOS, isTablet } from '../../utils/deviceInfo'; import { useOrientation } from '../../dimensions'; const styles = StyleSheet.create({ diff --git a/app/views/ThreadMessagesView/index.js b/app/views/ThreadMessagesView/index.js index 48cab9c99..7c604a43f 100644 --- a/app/views/ThreadMessagesView/index.js +++ b/app/views/ThreadMessagesView/index.js @@ -7,8 +7,6 @@ import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord'; import { withSafeAreaInsets } from 'react-native-safe-area-context'; import { HeaderBackButton } from '@react-navigation/stack'; -import styles from './styles'; -import Item from './Item'; import ActivityIndicator from '../../containers/ActivityIndicator'; import I18n from '../../i18n'; import RocketChat from '../../lib/rocketchat'; @@ -25,16 +23,18 @@ import { getUserSelector } from '../../selectors/login'; import SafeAreaView from '../../containers/SafeAreaView'; import * as HeaderButton from '../../containers/HeaderButton'; import * as List from '../../containers/List'; -import Dropdown from './Dropdown'; -import DropdownItemHeader from './Dropdown/DropdownItemHeader'; -import { FILTER } from './filters'; import BackgroundContainer from '../../containers/BackgroundContainer'; import { isIOS } from '../../utils/deviceInfo'; import { getBadgeColor, makeThreadName } from '../../utils/room'; import { getHeaderTitlePosition } from '../../containers/Header'; -import SearchHeader from './SearchHeader'; import EventEmitter from '../../utils/events'; import { LISTENER } from '../../containers/Toast'; +import SearchHeader from './SearchHeader'; +import { FILTER } from './filters'; +import DropdownItemHeader from './Dropdown/DropdownItemHeader'; +import Dropdown from './Dropdown'; +import Item from './Item'; +import styles from './styles'; const API_FETCH_COUNT = 50; diff --git a/app/views/UserNotificationPreferencesView/index.js b/app/views/UserNotificationPreferencesView/index.js index e05bb534f..98fded9a4 100644 --- a/app/views/UserNotificationPreferencesView/index.js +++ b/app/views/UserNotificationPreferencesView/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import { Text, StyleSheet } from 'react-native'; +import { StyleSheet, Text } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; @@ -10,10 +10,10 @@ import I18n from '../../i18n'; import RocketChat from '../../lib/rocketchat'; import { withTheme } from '../../theme'; import SafeAreaView from '../../containers/SafeAreaView'; -import { OPTIONS } from './options'; import ActivityIndicator from '../../containers/ActivityIndicator'; import { getUserSelector } from '../../selectors/login'; import sharedStyles from '../Styles'; +import { OPTIONS } from './options'; const styles = StyleSheet.create({ pickerText: { diff --git a/app/views/UserPreferencesView/index.js b/app/views/UserPreferencesView/index.js index bf94d31fb..4a3dc2467 100644 --- a/app/views/UserPreferencesView/index.js +++ b/app/views/UserPreferencesView/index.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import I18n from '../../i18n'; import { - logEvent, events + events, logEvent } from '../../utils/log'; import SafeAreaView from '../../containers/SafeAreaView'; import StatusBar from '../../containers/StatusBar'; diff --git a/app/views/VisitorNavigationView.js b/app/views/VisitorNavigationView.js index 0621a6f2d..84eb47be3 100644 --- a/app/views/VisitorNavigationView.js +++ b/app/views/VisitorNavigationView.js @@ -8,9 +8,9 @@ import { themes } from '../constants/colors'; import openLink from '../utils/openLink'; import I18n from '../i18n'; import debounce from '../utils/debounce'; -import sharedStyles from './Styles'; import * as List from '../containers/List'; import SafeAreaView from '../containers/SafeAreaView'; +import sharedStyles from './Styles'; const styles = StyleSheet.create({ noResult: { diff --git a/app/views/WithoutServersView.tsx b/app/views/WithoutServersView.tsx index b0c8e6128..3a807bfc9 100644 --- a/app/views/WithoutServersView.tsx +++ b/app/views/WithoutServersView.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { StyleSheet, View, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import ShareExtension from 'rn-extensions-share'; import * as HeaderButton from '../containers/HeaderButton'; @@ -13,17 +13,17 @@ const styles = StyleSheet.create({ flex: 1, justifyContent: 'center', alignItems: 'center', - padding: 15 + padding: 15, }, title: { fontSize: 18, - ...sharedStyles.textBold + ...sharedStyles.textBold, }, content: { fontSize: 14, ...sharedStyles.textRegular, - ...sharedStyles.textAlignCenter - } + ...sharedStyles.textAlignCenter, + }, }); class WithoutServerView extends React.Component { @@ -34,7 +34,7 @@ class WithoutServerView extends React.Component { onPress={ShareExtension.close} testID='share-extension-close' /> - ) + ), }) render() { diff --git a/app/views/WorkspaceView/ServerAvatar.js b/app/views/WorkspaceView/ServerAvatar.js index 0a82b30f3..b14bc393e 100644 --- a/app/views/WorkspaceView/ServerAvatar.js +++ b/app/views/WorkspaceView/ServerAvatar.js @@ -1,5 +1,5 @@ import React from 'react'; -import { StyleSheet, View, Text } from 'react-native'; +import { StyleSheet, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import { createImageProgress } from 'react-native-image-progress'; import * as Progress from 'react-native-progress'; diff --git a/app/views/WorkspaceView/index.js b/app/views/WorkspaceView/index.js index 553e7135e..93509e850 100644 --- a/app/views/WorkspaceView/index.js +++ b/app/views/WorkspaceView/index.js @@ -1,16 +1,16 @@ import React from 'react'; -import { View, Text } from 'react-native'; +import { Text, View } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import I18n from '../../i18n'; import Button from '../../containers/Button'; -import styles from './styles'; import { themes } from '../../constants/colors'; import { withTheme } from '../../theme'; import FormContainer, { FormContainerInner } from '../../containers/FormContainer'; -import ServerAvatar from './ServerAvatar'; import { getShowLoginButton } from '../../selectors/login'; +import ServerAvatar from './ServerAvatar'; +import styles from './styles'; class WorkspaceView extends React.Component { static navigationOptions = () => ({ diff --git a/e2e/helpers/data_setup.js b/e2e/helpers/data_setup.js index fd02a20c5..5b6b95b37 100644 --- a/e2e/helpers/data_setup.js +++ b/e2e/helpers/data_setup.js @@ -1,4 +1,5 @@ const axios = require('axios').default; + const data = require('../data'); const TEAM_TYPE = { diff --git a/e2e/tests/assorted/01-e2eencryption.spec.js b/e2e/tests/assorted/01-e2eencryption.spec.js index de5ccb225..831ca3d67 100644 --- a/e2e/tests/assorted/01-e2eencryption.spec.js +++ b/e2e/tests/assorted/01-e2eencryption.spec.js @@ -1,7 +1,6 @@ const { navigateToLogin, login, sleep, tapBack, mockMessage, searchRoom, logout } = require('../../helpers/app'); - const data = require('../../data'); const testuser = data.users.regular; diff --git a/e2e/tests/assorted/04-setting.spec.js b/e2e/tests/assorted/04-setting.spec.js index edfb3fd40..5e64a4b9f 100644 --- a/e2e/tests/assorted/04-setting.spec.js +++ b/e2e/tests/assorted/04-setting.spec.js @@ -1,5 +1,4 @@ const { navigateToLogin, login } = require('../../helpers/app'); - const data = require('../../data'); const testuser = data.users.regular; diff --git a/e2e/tests/assorted/06-status.spec.js b/e2e/tests/assorted/06-status.spec.js index 7eeb246b1..494fbec20 100644 --- a/e2e/tests/assorted/06-status.spec.js +++ b/e2e/tests/assorted/06-status.spec.js @@ -1,5 +1,4 @@ const { navigateToLogin, login, sleep } = require('../../helpers/app'); - const data = require('../../data'); const testuser = data.users.regular; diff --git a/e2e/tests/assorted/12-i18n.spec.js b/e2e/tests/assorted/12-i18n.spec.js index 1c4a6a9d5..b54489c9f 100644 --- a/e2e/tests/assorted/12-i18n.spec.js +++ b/e2e/tests/assorted/12-i18n.spec.js @@ -1,6 +1,5 @@ const { navigateToLogin, login, sleep } = require('../../helpers/app'); const { post } = require('../../helpers/data_setup'); - const data = require('../../data'); const testuser = data.users.regular; diff --git a/e2e/tests/init.js b/e2e/tests/init.js index b1e08a2bd..52d78b68a 100644 --- a/e2e/tests/init.js +++ b/e2e/tests/init.js @@ -1,5 +1,6 @@ const detox = require('detox'); const adapter = require('detox/runners/mocha/adapter'); + const config = require('../../package.json').detox; const { setup } = require('../helpers/data_setup'); diff --git a/index.js b/index.js index bbd7a5786..49d315b97 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ import 'react-native-gesture-handler'; import 'react-native-console-time-polyfill'; import { AppRegistry } from 'react-native'; + import { name as appName, share as shareName } from './app.json'; if (__DEV__) { diff --git a/storybook/stories/Message.js b/storybook/stories/Message.js index 6d6d2b4f1..411df1f1a 100644 --- a/storybook/stories/Message.js +++ b/storybook/stories/Message.js @@ -1,6 +1,6 @@ /* eslint-disable import/no-extraneous-dependencies */ import React from 'react'; -import { StyleSheet, ScrollView } from 'react-native'; +import { ScrollView, StyleSheet } from 'react-native'; import { Provider } from 'react-redux'; import { storiesOf } from '@storybook/react-native'; // import moment from 'moment'; @@ -9,7 +9,6 @@ import MessageComponent from '../../app/containers/message/Message'; import messagesStatus from '../../app/constants/messagesStatus'; import MessageSeparator from '../../app/views/RoomView/Separator'; import MessageContext from '../../app/containers/message/Context'; - import { themes } from '../../app/constants/colors'; import { store } from './index'; diff --git a/storybook/stories/RoomItem.js b/storybook/stories/RoomItem.js index c13eaa4d2..e63466d95 100644 --- a/storybook/stories/RoomItem.js +++ b/storybook/stories/RoomItem.js @@ -1,6 +1,6 @@ /* eslint-disable import/no-extraneous-dependencies */ import React from 'react'; -import { ScrollView, Dimensions } from 'react-native'; +import { Dimensions, ScrollView } from 'react-native'; import { storiesOf } from '@storybook/react-native'; import { Provider } from 'react-redux'; diff --git a/storybook/stories/UiKitMessage.js b/storybook/stories/UiKitMessage.js index 4fa2865f8..6c9957794 100644 --- a/storybook/stories/UiKitMessage.js +++ b/storybook/stories/UiKitMessage.js @@ -1,9 +1,9 @@ /* eslint-disable import/no-extraneous-dependencies */ import React from 'react'; -import { ScrollView, StyleSheet, SafeAreaView } from 'react-native'; +import { SafeAreaView, ScrollView, StyleSheet } from 'react-native'; import { storiesOf } from '@storybook/react-native'; -import MessageContext from '../../app/containers/message/Context'; +import MessageContext from '../../app/containers/message/Context'; import { UiKitMessage } from '../../app/containers/UIKit'; import { themes } from '../../app/constants/colors'; diff --git a/storybook/stories/UiKitModal.js b/storybook/stories/UiKitModal.js index 2ec9e1da6..9be40049b 100644 --- a/storybook/stories/UiKitModal.js +++ b/storybook/stories/UiKitModal.js @@ -1,9 +1,9 @@ /* eslint-disable import/no-extraneous-dependencies */ import React from 'react'; -import { ScrollView, StyleSheet, SafeAreaView } from 'react-native'; +import { SafeAreaView, ScrollView, StyleSheet } from 'react-native'; import { storiesOf } from '@storybook/react-native'; -import { UiKitModal, UiKitComponent } from '../../app/containers/UIKit'; +import { UiKitComponent, UiKitModal } from '../../app/containers/UIKit'; import { KitContext, defaultContext } from '../../app/containers/UIKit/utils'; import MessageContext from '../../app/containers/message/Context'; import { themes } from '../../app/constants/colors'; diff --git a/storybook/stories/index.js b/storybook/stories/index.js index b695d49d6..f5e9349ae 100644 --- a/storybook/stories/index.js +++ b/storybook/stories/index.js @@ -1,5 +1,5 @@ /* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ -import { createStore, combineReducers } from 'redux'; +import { combineReducers, createStore } from 'redux'; import './RoomItem'; import './List';