mattermost-mobile/app/screens/index.js
Jesús Espino 8ef65d8b24
Voicechannels (#5753)
* Some extra work on voice channels interface

* Fixing some TODOs

* Improving styling of call in channel

* Improve calls monitoring

* Replacing some of the fontawesome icons with the compass ones

* Improving the layout

* Migrating to webrtc2 for unified plan

* Add screen on and off behavior

* Adding incall manager plugin

* Moving everything into the products/calls folder

* Make products modules routes relatives

* Make products modules routes @mmproducts

* Removing initiator parameter

* Removing trickle parameter

* Simplifying code

* Removing underscore from private variables

* Removing underscore from private things

* More simplifications

* More simplifications

* More simplifications

* Changing sha sum for mmjstool

* Fixing typo

* Migrating simple-peer to typescript

* Migrating simple-peer to typescript

* Improving the size of the screen share

* Adding feature flag to disable the calls feature in mobile

* Fixing some tests

* Removing obsolte tests

* Added call ended support for the post messages

* Fixing some warnings in the tests

* Adding JoinCall tests

* Adding CallMessage tests

* Adding CurrentCall unit tests

* Adding CallAvatar unit tests

* Adding FloatingCallContainer unit tests

* Adding StartCall unit tests

* Adding EnableDisableCalls unit tests

* Adding CallDuration tests

* Improving CallDuration tests

* Adding CallScreen unit tests

* Adding CallOtherActions screen tests

* Fixing some dark theme styles

* Fixing tests

* More robustness around connecting/disconnecting

* Adding FormattedRelativeTime tests

* Adding tests for ChannelItem

* Adding tests for ChannelInfo

* Adding selectors tests

* Adding reducers unit tests

* Adding actions tests

* Removing most of the TODOs

* Removing another TODO

* Updating tests snapshots

* Removing the last TODO

* Fixed a small problem on pressing while a call is ongoing

* Remove all the inlined functions

* Replacing usage of isLandscape selector with useWindowDimensions

* Removed unnecesary makeStyleSheetFromTheme

* Removing unneded  properties from call_duration

* Fixing possible null channels return from getChannel selector

* Moving other inlined functions to its own constant

* Simplifiying enable/disable calls component

* Improving the behavior when you are in the call of the current channel

* Adding missing translation strings

* Simplified a bit the EnableDisableCalls component

* Moving other inlined functions to its own constant

* Updating snapshots

* Improving usage of makeStyleSheetFromTheme

* Moving data reformating from the rest client to the redux action

* Adding calls to the blocklist to the redux-persist

* Fixing tests

* Updating snapshots

* Update file icon name to the last compass icons version

* Fix loading state

* Only show the call connected if the websocket gets connected

* Taking into consideration the indicator bar to position the calls new bars

* Making the MoreMessagesButton component aware of calls components

* Updating snapshots

* Fixing tests

* Updating snapshot

* Fixing different use cases for start call channel menu

* Fixing tests

* Ask for confirmation to start a call when you are already in another call

* Update app/products/calls/components/floating_call_container.tsx

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

* Memoizing userIds in join call

* Applying suggestion around combine the blocklist for calls with the one for typing

* Adding explicit types to the rest client

* Removing unneeded permission

* Making updateIntervalInSeconds prop optional in FormattedRelativeTime

* Making updateIntervalInSeconds prop optional in CallDuration

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-11-11 11:32:39 +01:00

251 lines
8.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {Platform} from 'react-native';
import {ThemeProvider} from 'react-native-elements';
import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
import {Navigation} from 'react-native-navigation';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {Provider} from 'react-redux';
import RootWrapper from '@components/root';
import ThreadFollow from '@screens/thread/thread_follow';
let store;
const withGestures = (screen, styles) => {
if (Platform.OS === 'android') {
return gestureHandlerRootHOC(screen, styles);
}
return screen;
};
// eslint-disable-next-line react/display-name
export const withReduxProvider = (Screen, excludeEvents = true) => (props) => (
<Provider store={store}>
<ThemeProvider>
<RootWrapper excludeEvents={excludeEvents}>
<SafeAreaProvider>
<Screen {...props}/>
</SafeAreaProvider>
</RootWrapper>
</ThemeProvider>
</Provider>
);
Navigation.setLazyComponentRegistrator((screenName) => {
let screen;
let extraStyles;
switch (screenName) {
case 'About':
screen = require('@screens/about').default;
break;
case 'AddReaction':
screen = require('@screens/add_reaction').default;
break;
case 'AdvancedSettings':
screen = require('@screens/settings/advanced_settings').default;
break;
case 'AppForm':
screen = require('@screens/apps_form').default;
break;
case 'ChannelAddMembers':
screen = require('@screens/channel_add_members').default;
break;
case 'ChannelInfo':
screen = require('@screens/channel_info').default;
break;
case 'ChannelMembers':
screen = require('@screens/channel_members').default;
break;
case 'ChannelNotificationPreference':
screen = require('@screens/channel_notification_preference').default;
break;
case 'ClearAfter':
screen = require('@screens/custom_status_clear_after/clear_after_modal').default;
break;
case 'ClockDisplaySettings':
screen = require('@screens/settings/clock_display').default;
break;
case 'Code':
screen = require('@screens/code').default;
break;
case 'CreateChannel':
screen = require('@screens/create_channel').default;
break;
case 'CustomStatus':
screen = require('@screens/custom_status').default;
break;
case 'DisplaySettings':
screen = require('@screens/settings/display_settings').default;
break;
case 'EditChannel':
screen = require('@screens/edit_channel').default;
break;
case 'EditPost':
screen = require('@screens/edit_post').default;
break;
case 'EditProfile':
screen = require('@screens/edit_profile').default;
break;
case 'ErrorTeamsList':
screen = require('@screens/error_teams_list').default;
break;
case 'ExpandedAnnouncementBanner':
screen = require('@screens/expanded_announcement_banner').default;
break;
case 'SavedPosts':
screen = require('@screens/saved_posts').default;
break;
case 'ForgotPassword':
screen = require('@screens/forgot_password').default;
break;
case 'Gallery':
screen = require('@screens/gallery').default;
break;
case 'GlobalThreadOptions':
screen = require('@screens/thread_options').default;
break;
case 'InteractiveDialog':
screen = require('@screens/interactive_dialog').default;
break;
case 'Login':
screen = require('@screens/login').default;
break;
case 'LoginOptions':
screen = require('@screens/login_options').default;
break;
case 'MainSidebar':
screen = require('app/components/sidebars/main').default;
break;
case 'Call':
screen = require('@mmproducts/calls/screens/call').default;
break;
case 'MFA':
screen = require('@screens/mfa').default;
break;
case 'MoreChannels':
screen = require('@screens/more_channels').default;
break;
case 'MoreDirectMessages':
screen = require('@screens/more_dms').default;
break;
case 'Notification':
extraStyles = Platform.select({android: {flex: undefined, height: 100}});
screen = require('@screens/notification/index.tsx').default;
break;
case 'NotificationSettings':
screen = require('@screens/settings/notification_settings').default;
break;
case 'NotificationSettingsAutoResponder':
screen = require('@screens/settings/notification_settings_auto_responder').default;
break;
case 'NotificationSettingsEmail':
screen = require('@screens/settings/notification_settings_email').default;
break;
case 'NotificationSettingsMentions':
screen = require('@screens/settings/notification_settings_mentions').default;
break;
case 'NotificationSettingsMentionsKeywords':
screen = require('@screens/settings/notification_settings_mentions_keywords').default;
break;
case 'NotificationSettingsMobile':
screen = require('@screens/settings/notification_settings_mobile').default;
break;
case 'OptionsModal':
screen = require('@screens/options_modal').default;
break;
case 'ParticipantsList':
screen = require('@screens/participants_list').default;
break;
case 'PerfMetrics':
screen = require('@screens/perf_metrics').default;
break;
case 'Permalink':
screen = require('@screens/permalink').default;
break;
case 'PinnedPosts':
screen = require('@screens/pinned_posts').default;
break;
case 'PostOptions':
screen = require('@screens/post_options').default;
break;
case 'CallOtherActions':
screen = require('@mmproducts/calls/screens/call_other_actions').default;
break;
case 'ReactionList':
screen = require('@screens/reaction_list').default;
break;
case 'RecentMentions':
screen = require('@screens/recent_mentions').default;
break;
case 'Search':
screen = require('@screens/search').default;
break;
case 'SelectorScreen':
screen = require('@screens/selector_screen').default;
break;
case 'SelectTeam':
screen = require('@screens/select_team').default;
break;
case 'SelectTimezone':
screen = require('@screens/settings/timezone/select_timezone').default;
break;
case 'Settings':
screen = require('@screens/settings/general').default;
break;
case 'SettingsSidebar':
screen = require('app/components/sidebars/settings').default;
break;
case 'SidebarSettings':
screen = require('@screens/settings/sidebar').default;
break;
case 'SSO':
screen = require('@screens/sso').default;
break;
case 'Table':
screen = require('@screens/table').default;
break;
case 'TermsOfService':
screen = require('@screens/terms_of_service').default;
break;
case 'ThemeSettings':
screen = require('@screens/settings/theme').default;
break;
case 'Thread':
screen = require('@screens/thread').default;
break;
case 'ThreadFollow': {
Navigation.registerComponent('ThreadFollow', () => ThreadFollow);
break;
}
case 'TimezoneSettings':
screen = require('@screens/settings/timezone').default;
break;
case 'UserProfile':
screen = require('@screens/user_profile').default;
break;
case 'PluginInternal':
screen = require('@screens/plugin').default;
break;
case 'SlideUp':
screen = require('@screens/slide_up').default;
break;
}
if (screen) {
Navigation.registerComponent(screenName, () => withGestures(withReduxProvider(screen), extraStyles), () => screen);
}
});
export function registerScreens(reduxStore) {
store = reduxStore;
const channelScreen = require('@screens/channel').default;
const serverScreen = require('@screens/select_server').default;
Navigation.registerComponent('Channel', () => withReduxProvider(channelScreen, false), () => channelScreen);
Navigation.registerComponent('SelectServer', () => withReduxProvider(serverScreen, false), () => serverScreen);
}