Skip to content
Merged
Show file tree
Hide file tree
Changes from 127 commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
f1e9d5d
react-navigation v5 installed
diegolmello May 21, 2020
796c82a
compiling
diegolmello May 21, 2020
3def144
Outside working
diegolmello May 21, 2020
0cc510d
InsideStack compiling
diegolmello May 21, 2020
3867e57
Switch stack
diegolmello May 21, 2020
e4de36d
Starting room
diegolmello May 21, 2020
f764527
RoomView header
diegolmello May 21, 2020
a895d41
SafeAreaView
diegolmello May 21, 2020
e03d423
Slide from right stack animation
diegolmello May 21, 2020
f59d8e0
stash
diegolmello May 21, 2020
ae459d1
Fix params
diegolmello May 22, 2020
1ec094c
Create channel
diegolmello May 22, 2020
57d13e9
inapp notification
diegolmello May 26, 2020
cef50fe
Custom status
diegolmello May 26, 2020
3b93c11
Add server working
diegolmello May 26, 2020
988d3a3
Refactor appStart
diegolmello May 26, 2020
3347a67
Attachment
diegolmello May 26, 2020
99e4dfc
in-app notification
diegolmello May 26, 2020
c60bdfb
AuthLoadingView
diegolmello May 26, 2020
0bda859
Remove compat
diegolmello May 26, 2020
5ca94ee
Navigation
diegolmello May 26, 2020
06684cb
Outside animations
diegolmello May 27, 2020
cabf630
Fix new server icon
diegolmello May 27, 2020
c2a1173
block modal
diegolmello May 27, 2020
40b38b7
AttachmentView header
diegolmello May 27, 2020
739f885
Remove unnecessary code
diegolmello May 27, 2020
69e2fe8
SelectedUsersView header
diegolmello May 27, 2020
6c132cb
StatusView
diegolmello May 27, 2020
97ae9bc
CreateDiscussionView
diegolmello May 27, 2020
15e1897
RoomInfoView
diegolmello May 27, 2020
816cb43
RoomInfoEditView style
diegolmello May 27, 2020
a1c2875
RoomMembersView
diegolmello May 27, 2020
1f6bb5d
RoomsListView header
diegolmello May 27, 2020
009de40
RoomView header
diegolmello May 27, 2020
ffda9e5
Share extension
diegolmello May 27, 2020
4f010e5
getParam
diegolmello May 28, 2020
452620c
Focus/blur
diegolmello May 28, 2020
ff5b5b3
Trying to fix inapp
diegolmello May 28, 2020
0b0e768
Lint
diegolmello May 28, 2020
7413d26
Merge branch 'develop' into update-rn-5
diegolmello May 28, 2020
1e49d80
Simpler app container
diegolmello May 28, 2020
f721c96
Update libs
diegolmello May 29, 2020
48e47f2
Revert "Simpler app container"
diegolmello May 29, 2020
612a5d8
Load messages faster
diegolmello May 29, 2020
69930cd
Fix safearea on ReactionsModal
diegolmello May 29, 2020
945c096
Update safe area to v3
diegolmello Jun 1, 2020
4d8a758
lint
diegolmello Jun 1, 2020
790599f
Fix transition
diegolmello Jun 1, 2020
2e247cc
stash - drawer replace working
diegolmello Jun 1, 2020
f08ef94
stash - modal nav
diegolmello Jun 1, 2020
e597a44
RoomActionsView as tablet modal
diegolmello Jun 2, 2020
42225b6
RoomStack
diegolmello Jun 2, 2020
f6ea268
Stop showing RoomView header when there's no room
diegolmello Jun 2, 2020
28e5b90
Custom Header and different navigation based on stack
diegolmello Jun 2, 2020
ed2ca11
Refactor setHeader
diegolmello Jun 2, 2020
0e03328
MasterDetailContext
diegolmello Jun 2, 2020
763f494
RoomView header
diegolmello Jun 3, 2020
15ad611
Fix isMasterDetail rule
diegolmello Jun 3, 2020
a24b97b
KeyCommands kind of working
diegolmello Jun 3, 2020
20b768f
Create channel on tablet
diegolmello Jun 3, 2020
7dcb38b
RoomView sCU
diegolmello Jun 3, 2020
98dc19d
Remove withSplit
diegolmello Jun 3, 2020
b7e634a
Settings opening as modal
diegolmello Jun 3, 2020
383b060
Settings
diegolmello Jun 3, 2020
631aa9c
StatusView headerLeft
diegolmello Jun 3, 2020
fa33770
Admin panel
diegolmello Jun 3, 2020
8977bc2
TwoFactor style
diegolmello Jun 3, 2020
06f2e58
DirectoryView
diegolmello Jun 3, 2020
5f5461d
ServerDropdown and SortDropdown animations
diegolmello Jun 3, 2020
28b68fa
ThreadMessagesView
diegolmello Jun 3, 2020
be5974c
Navigate to empty RoomView on server switch when in master detail
diegolmello Jun 3, 2020
650ada5
ProfileView header
diegolmello Jun 3, 2020
a7df8a7
Fix navigation issues
diegolmello Jun 3, 2020
7f7184a
Nav to any room info on tablet
diegolmello Jun 3, 2020
4f970ac
Room info
diegolmello Jun 3, 2020
69b4e33
Refactoring
diegolmello Jun 3, 2020
8e07b3c
Fix rooms search
diegolmello Jun 3, 2020
c6dcbd6
Roomslist commands
diegolmello Jun 3, 2020
164c769
SearchMessagesView close modal
diegolmello Jun 3, 2020
c1d2445
Key commands
diegolmello Jun 4, 2020
8e9066b
Fix undefined subscription
diegolmello Jun 4, 2020
b57284d
Disallow navigate to focused room
diegolmello Jun 4, 2020
52d22ed
isFocused state on RoomsListView
diegolmello Jun 4, 2020
f8f629e
Blur text inputs when focus is lost
diegolmello Jun 4, 2020
e53bc36
Replace animation
diegolmello Jun 4, 2020
38088d0
Default nav theme
diegolmello Jun 4, 2020
f0be483
Refactoring
diegolmello Jun 4, 2020
c66e286
Always open Attachment with close modal button
diegolmello Jun 4, 2020
3466050
ModalContainer backdrop following themes
diegolmello Jun 4, 2020
faa0850
Screen tracking
diegolmello Jun 4, 2020
b0a5c94
Refactor get active route for in-app notification
diegolmello Jun 4, 2020
5f79b90
Only mark room as focused when in master detail layout
diegolmello Jun 4, 2020
6ba9036
Lint
diegolmello Jun 4, 2020
01e7591
Open modals as fade from bottom on Android
diegolmello Jun 4, 2020
0da8abf
typo
diegolmello Jun 4, 2020
064ae52
Fixing tests
diegolmello Jun 4, 2020
4ddae42
Fix in-app update
diegolmello Jun 5, 2020
920f1a9
Merge branch 'develop' into update-rn-5
diegolmello Jun 5, 2020
c5fcde1
Fixing goRoom issues
diegolmello Jun 8, 2020
7025ba3
Refactor stack names
diegolmello Jun 8, 2020
60dbce9
Fix unreadsCount
diegolmello Jun 8, 2020
8a4c0c0
Fix stack
diegolmello Jun 9, 2020
f80e798
Fix header animation
diegolmello Jun 9, 2020
44c451d
Refactor ShareNavigation
diegolmello Jun 9, 2020
45e86a3
Refactor navigation theme
diegolmello Jun 9, 2020
4568de2
Make sure title is set
diegolmello Jun 9, 2020
5497c7e
Fix create discussion navigation
diegolmello Jun 9, 2020
251edd5
Remove unused variable
diegolmello Jun 9, 2020
85a2804
Create discussions from actions fixed
diegolmello Jun 9, 2020
63295c3
Layout animation
diegolmello Jun 9, 2020
16c7a44
Screen lock on share extension
diegolmello Jun 9, 2020
0f17f45
Unnecessary change
diegolmello Jun 9, 2020
074dc2a
Admin border
diegolmello Jun 9, 2020
171ef1f
Set header after state callback
diegolmello Jun 9, 2020
fd6ae51
Fix key commands on outside stack
diegolmello Jun 9, 2020
dbbad2c
Fix back button pressed
diegolmello Jun 9, 2020
4839a35
Remove layout animations from Android
diegolmello Jun 10, 2020
ce934dc
Tweak animations on Android
diegolmello Jun 10, 2020
bbe1b7a
Disable swipe gesture to open drawer
diegolmello Jun 10, 2020
d373467
Fix current item on RoomsListView
diegolmello Jun 10, 2020
c3e0164
Fix add server
diegolmello Jun 10, 2020
1d76b3e
Merge branch 'develop' into update-rn-5
diegolmello Jun 10, 2020
ac2fd40
Fix drawer
diegolmello Jun 12, 2020
3cc29b1
Fix broadcast
diegolmello Jun 12, 2020
868f78b
LayoutAnimation instead of Transitions
diegolmello Jun 12, 2020
edb7db8
Fix onboarding back press
diegolmello Jun 12, 2020
798bbc8
Fix assorted tests
diegolmello Jun 12, 2020
97acd69
Create discussion fix
diegolmello Jun 15, 2020
8253145
Merge branch 'develop' into update-rn-5
diegolmello Jun 15, 2020
2339933
RoomInfoView header
diegolmello Jun 15, 2020
60288dc
Merge branch 'update-rn-5' of github.com:RocketChat/Rocket.Chat.React…
diegolmello Jun 15, 2020
ef81cec
Drawer active item
diegolmello Jun 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions app/AppContainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import React from 'react';
import PropTypes from 'prop-types';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { connect } from 'react-redux';
import { SafeAreaProvider, initialWindowMetrics } from 'react-native-safe-area-context';

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_BACKGROUND
} 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';
import { ThemeContext } from './theme';
import { setCurrentScreen } from './utils/log';

// SetUsernameStack
const SetUsername = createStackNavigator();
const SetUsernameStack = () => (
<SetUsername.Navigator screenOptions={defaultHeader}>
<SetUsername.Screen
name='SetUsernameView'
component={SetUsernameView}
/>
</SetUsername.Navigator>
);

// App
const Stack = createStackNavigator();
const App = React.memo(({ root, isMasterDetail }) => {
if (!root) {
return null;
}

const { theme } = React.useContext(ThemeContext);
const navTheme = navigationTheme(theme);

React.useEffect(() => {
const state = Navigation.navigationRef.current.getRootState();
const currentRouteName = getActiveRouteName(state);
Navigation.routeNameRef.current = currentRouteName;
setCurrentScreen(currentRouteName);
}, []);

return (
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<NavigationContainer
theme={navTheme}
ref={Navigation.navigationRef}
onStateChange={(state) => {
const previousRouteName = Navigation.routeNameRef.current;
const currentRouteName = getActiveRouteName(state);
if (previousRouteName !== currentRouteName) {
setCurrentScreen(currentRouteName);
}
Navigation.routeNameRef.current = currentRouteName;
}}
>
<Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}>
<>
{root === ROOT_LOADING || root === ROOT_BACKGROUND ? (
<Stack.Screen
name='AuthLoading'
component={AuthLoadingView}
/>
) : null}
{root === ROOT_OUTSIDE || root === ROOT_NEW_SERVER ? (
<Stack.Screen
name='OutsideStack'
component={OutsideStack}
/>
) : null}
{root === ROOT_INSIDE && isMasterDetail ? (
<Stack.Screen
name='MasterDetailStack'
component={MasterDetailStack}
/>
) : null}
{root === ROOT_INSIDE && !isMasterDetail ? (
<Stack.Screen
name='InsideStack'
component={InsideStack}
/>
) : null}
{root === ROOT_SET_USERNAME ? (
<Stack.Screen
name='SetUsernameStack'
component={SetUsernameStack}
/>
) : null}
</>
</Stack.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
});
const mapStateToProps = state => ({
root: state.app.root,
isMasterDetail: state.app.isMasterDetail
});

App.propTypes = {
root: PropTypes.string,
isMasterDetail: PropTypes.bool
};

const AppContainer = connect(mapStateToProps)(App);
export default AppContainer;
2 changes: 1 addition & 1 deletion app/actions/actionsTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ROOMS = createRequestTypes('ROOMS', [
'CLOSE_SEARCH_HEADER'
]);
export const ROOM = createRequestTypes('ROOM', ['SUBSCRIBE', 'UNSUBSCRIBE', 'LEAVE', 'DELETE', 'REMOVED', 'CLOSE', 'FORWARD', 'USER_TYPING']);
export const APP = createRequestTypes('APP', ['START', 'READY', 'INIT', 'INIT_LOCAL_SETTINGS']);
export const APP = createRequestTypes('APP', ['START', 'READY', 'INIT', 'INIT_LOCAL_SETTINGS', 'SET_MASTER_DETAIL']);
export const MESSAGES = createRequestTypes('MESSAGES', ['REPLY_BROADCAST']);
export const CREATE_CHANNEL = createRequestTypes('CREATE_CHANNEL', [...defaultTypes]);
export const CREATE_DISCUSSION = createRequestTypes('CREATE_DISCUSSION', [...defaultTypes]);
Expand Down
41 changes: 41 additions & 0 deletions app/actions/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { APP } from './actionsTypes';

export const ROOT_OUTSIDE = 'outside';
export const ROOT_INSIDE = 'inside';
export const ROOT_LOADING = 'loading';
export const ROOT_NEW_SERVER = 'newServer';
export const ROOT_SET_USERNAME = 'setUsername';
export const ROOT_BACKGROUND = 'background';

export function appStart({ root, ...args }) {
return {
type: APP.START,
root,
...args
};
}

export function appReady() {
return {
type: APP.READY
};
}

export function appInit() {
return {
type: APP.INIT
};
}

export function appInitLocalSettings() {
return {
type: APP.INIT_LOCAL_SETTINGS
};
}

export function setMasterDetail(isMasterDetail) {
return {
type: APP.SET_MASTER_DETAIL,
isMasterDetail
};
}
41 changes: 0 additions & 41 deletions app/actions/index.js

This file was deleted.

5 changes: 3 additions & 2 deletions app/actions/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ export function serverFailure(err) {
};
}

export function serverInitAdd() {
export function serverInitAdd(previousServer) {
return {
type: SERVER.INIT_ADD
type: SERVER.INIT_ADD,
previousServer
};
}

Expand Down
13 changes: 7 additions & 6 deletions app/commands.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-bitwise */
import { constants } from 'react-native-keycommands';
import KeyCommands, { constants } from 'react-native-keycommands';

import I18n from './i18n';

Expand All @@ -17,7 +17,7 @@ const KEY_ADD_SERVER = __DEV__ ? 'l' : 'n';
const KEY_SEND_MESSAGE = '\r';
const KEY_SELECT = '123456789';

export const defaultCommands = [
const keyCommands = [
{
// Focus messageBox
input: KEY_TYPING,
Expand All @@ -29,10 +29,7 @@ export const defaultCommands = [
input: KEY_SEND_MESSAGE,
modifierFlags: 0,
discoverabilityTitle: I18n.t('Send')
}
];

export const keyCommands = [
},
{
// Open Preferences Modal
input: KEY_PREFERENCES,
Expand Down Expand Up @@ -139,6 +136,10 @@ export const keyCommands = [
})))
];

export const setKeyCommands = () => KeyCommands.setKeyCommands(keyCommands);

export const deleteKeyCommands = () => KeyCommands.deleteKeyCommands(keyCommands);

export const KEY_COMMAND = 'KEY_COMMAND';

export const commandHandle = (event, key, flags = []) => {
Expand Down
3 changes: 1 addition & 2 deletions app/constants/tablet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export const MAX_SIDEBAR_WIDTH = 321;
export const MAX_CONTENT_WIDTH = '90%';
export const MAX_SCREEN_CONTENT_WIDTH = '50%';
export const MIN_WIDTH_SPLIT_LAYOUT = 700;
export const MIN_WIDTH_MASTER_DETAIL_LAYOUT = 700;
4 changes: 0 additions & 4 deletions app/constants/types.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/containers/FormContainer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { ScrollView, StyleSheet, View } from 'react-native';
import PropTypes from 'prop-types';
import { SafeAreaView } from 'react-navigation';

import { themes } from '../constants/colors';
import sharedStyles from '../views/Styles';
Expand All @@ -10,6 +9,7 @@ import KeyboardView from '../presentation/KeyboardView';
import StatusBar from './StatusBar';
import AppVersion from './AppVersion';
import { isTablet } from '../utils/deviceInfo';
import SafeAreaView from './SafeAreaView';

const styles = StyleSheet.create({
scrollView: {
Expand All @@ -31,7 +31,7 @@ const FormContainer = ({ children, theme, testID }) => (
>
<StatusBar theme={theme} />
<ScrollView {...scrollPersistTaps} style={sharedStyles.container} contentContainerStyle={[sharedStyles.containerScrollView, styles.scrollView]}>
<SafeAreaView style={sharedStyles.container} forceInset={{ top: 'never' }} testID={testID}>
<SafeAreaView testID={testID} theme={theme} style={{ backgroundColor: themes[theme].backgroundColor }}>
{children}
<AppVersion theme={theme} />
</SafeAreaView>
Expand Down
40 changes: 40 additions & 0 deletions app/containers/Header/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import PropTypes from 'prop-types';
import { SafeAreaView } from 'react-native-safe-area-context';
import { View, StyleSheet } from 'react-native';
import { themes } from '../../constants/colors';
import { themedHeader } from '../../utils/navigation';
import { isIOS } from '../../utils/deviceInfo';

// Get from https://github.com/react-navigation/react-navigation/blob/master/packages/stack/src/views/Header/HeaderSegment.tsx#L69
export const headerHeight = isIOS ? 44 : 56;
Comment thread
diegolmello marked this conversation as resolved.

const styles = StyleSheet.create({
container: {
height: headerHeight,
flexDirection: 'row',
justifyContent: 'center',
elevation: 4
}
});

const Header = ({
theme, headerLeft, headerTitle, headerRight
}) => (
<SafeAreaView style={{ backgroundColor: themes[theme].headerBackground }} edges={['top', 'left', 'right']}>
<View style={[styles.container, { ...themedHeader(theme).headerStyle }]}>
Comment thread
diegolmello marked this conversation as resolved.
{headerLeft ? headerLeft() : null}
{headerTitle ? headerTitle() : null}
{headerRight ? headerRight() : null}
</View>
</SafeAreaView>
);

Header.propTypes = {
theme: PropTypes.string,
headerLeft: PropTypes.element,
headerTitle: PropTypes.element,
headerRight: PropTypes.element
};

export default Header;
3 changes: 1 addition & 2 deletions app/containers/LoginServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Base64 } from 'js-base64';
import { withNavigation } from 'react-navigation';

import { withTheme } from '../theme';
import sharedStyles from '../views/Styles';
Expand Down Expand Up @@ -361,4 +360,4 @@ const mapDispatchToProps = dispatch => ({
loginRequest: params => dispatch(loginRequestAction(params))
});

export default connect(mapStateToProps, mapDispatchToProps)(withTheme(withNavigation(LoginServices)));
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(LoginServices));
Loading