Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c1cfa64
create types
gerzonc Nov 2, 2021
c5b6f65
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Nov 2, 2021
3926244
Update navigation interface for some components and global navigation…
gerzonc Nov 3, 2021
e346260
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Nov 10, 2021
ee14efa
Add more global definitions and update MasterDetailStack and OutsideS…
gerzonc Nov 10, 2021
e11390c
complete outsidestack param list
gerzonc Nov 15, 2021
5dbac8c
add masterdetailstack types
gerzonc Nov 16, 2021
857ea57
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Nov 16, 2021
61ca161
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Nov 16, 2021
793362a
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Nov 17, 2021
3546d1d
update views interfaces, create IServer.ts
gerzonc Nov 17, 2021
e205f4f
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Nov 18, 2021
e397041
update interfaces and types
gerzonc Nov 18, 2021
d0d918a
update screens interfaces
gerzonc Nov 22, 2021
88a91f5
navigationTypes for AppContainer
gerzonc Nov 22, 2021
f8f0eca
added share navigationTypes, updated stack types and masterdetail types
gerzonc Nov 23, 2021
9ea95da
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Nov 23, 2021
e917585
refactor: minor tweak
AlexAlexandre Dec 1, 2021
f336c0d
refactor: minor tweak
AlexAlexandre Dec 1, 2021
d05a603
refactor: minor tweak
AlexAlexandre Dec 1, 2021
6b8c886
refactor: completing the interface IAttachment
AlexAlexandre Dec 1, 2021
4659c63
refactor: minor tweak
AlexAlexandre Dec 1, 2021
4287d9c
refactor: minor tweak
AlexAlexandre Dec 1, 2021
d05a7b8
update withTheme param type and remove unnecessary options
gerzonc Dec 1, 2021
0cf961f
Undo withTheme changes to open a new PR around it
gerzonc Dec 1, 2021
4edb591
refactor: Undo withTheme changes to open a new PR around it
AlexAlexandre Dec 1, 2021
81b2769
refactor: change the HOC to improvement on next PR
AlexAlexandre Dec 1, 2021
79deb1c
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
gerzonc Dec 2, 2021
adfa5d2
Fix interfaces and temp solution for screens
gerzonc Dec 2, 2021
1a13d44
Minor tweak
gerzonc Dec 2, 2021
f1b413c
chore: Minor tweak
AlexAlexandre Dec 2, 2021
4f00235
Merge branch 'develop' into chore.migrate-react-navigation-to-ts
diegolmello Dec 3, 2021
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
5 changes: 3 additions & 2 deletions app/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { connect } from 'react-redux';

import { SetUsernameStackParamList, StackParamList } from './navigationTypes';
import Navigation from './lib/Navigation';
import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation';
import { ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app';
Expand All @@ -17,15 +18,15 @@ import { ThemeContext } from './theme';
import { setCurrentScreen } from './utils/log';

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

// App
const Stack = createStackNavigator();
const Stack = createStackNavigator<StackParamList>();
const App = React.memo(({ root, isMasterDetail }: { root: string; isMasterDetail: boolean }) => {
if (!root) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion app/containers/ActionSheet/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const useActionSheet = () => useContext(context);

const { Provider, Consumer } = context;

export const withActionSheet = <P extends object>(Component: React.ComponentType<P>) =>
export const withActionSheet = (Component: any): any =>
forwardRef((props: any, ref: ForwardedRef<any>) => (
<Consumer>{(contexts: any) => <Component {...props} {...contexts} ref={ref} />}</Consumer>
));
Expand Down
5 changes: 3 additions & 2 deletions app/containers/EmojiPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface IEmojiPickerProps {
customEmojis?: any;
style: object;
theme?: string;
onEmojiSelected?: Function;
onEmojiSelected?: ((emoji: any) => void) | ((keyboardId: any, params?: any) => void);
tabEmojiStyle?: object;
}

Expand Down Expand Up @@ -201,4 +201,5 @@ const mapStateToProps = (state: any) => ({
customEmojis: state.customEmojis
});

export default connect(mapStateToProps)(withTheme(EmojiPicker));
// TODO - remove this as any, at the new PR to fix the HOC erros
export default connect(mapStateToProps)(withTheme(EmojiPicker)) as any;
2 changes: 1 addition & 1 deletion app/containers/LoginServices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,4 @@ const mapStateToProps = (state: any) => ({
services: state.login.services
});

export default connect(mapStateToProps)(withTheme(LoginServices));
export default connect(mapStateToProps)(withTheme(LoginServices)) as any;
2 changes: 1 addition & 1 deletion app/containers/MessageBox/EmojiKeyboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface IMessageBoxEmojiKeyboard {
}

export default class EmojiKeyboard extends React.PureComponent<IMessageBoxEmojiKeyboard, any> {
private readonly baseUrl: any;
private readonly baseUrl: string;

constructor(props: IMessageBoxEmojiKeyboard) {
super(props);
Expand Down
2 changes: 1 addition & 1 deletion app/containers/MessageBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1124,4 +1124,4 @@ const dispatchToProps = {
typing: (rid: any, status: any) => userTypingAction(rid, status)
};
// @ts-ignore
export default connect(mapStateToProps, dispatchToProps, null, { forwardRef: true })(withActionSheet(MessageBox));
export default connect(mapStateToProps, dispatchToProps, null, { forwardRef: true })(withActionSheet(MessageBox)) as any;
4 changes: 2 additions & 2 deletions app/containers/SearchBox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { StyleSheet, Text, TextInputProps, View } from 'react-native';
import Touchable from 'react-native-platform-touchable';

import TextInput from '../presentation/TextInput';
Expand Down Expand Up @@ -45,7 +45,7 @@ const styles = StyleSheet.create({
});

interface ISearchBox {
onChangeText: () => void;
onChangeText: TextInputProps['onChangeText'];
onSubmitEditing: () => void;
hasCancel: boolean;
onCancelPress: Function;
Expand Down
10 changes: 10 additions & 0 deletions app/definitions/IAttachment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface IAttachment {
title: string;
type: string;
description: string;
title_link?: string;
image_url?: string;
image_type?: string;
video_url?: string;
video_type?: string;
}
3 changes: 3 additions & 0 deletions app/definitions/IMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface IMessage {
msg: string;
}
4 changes: 4 additions & 0 deletions app/definitions/IRocketChatRecord.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface IRocketChatRecord {
id: string;
updatedAt: Date;
}
27 changes: 27 additions & 0 deletions app/definitions/IRoom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { IRocketChatRecord } from './IRocketChatRecord';

export enum RoomType {
GROUP = 'p',
DIRECT = 'd',
CHANNEL = 'c',
OMNICHANNEL = 'l',
THREAD = 'thread'
}

export interface IRoom extends IRocketChatRecord {
rid: string;
t: RoomType;
name: string;
fname: string;
prid?: string;
tmid?: string;
topic?: string;
teamMain?: boolean;
teamId?: string;
encrypted?: boolean;
visitor?: boolean;
autoTranslateLanguage?: boolean;
autoTranslate?: boolean;
observe?: Function;
usedCannedResponse: string;
}
16 changes: 16 additions & 0 deletions app/definitions/IServer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export interface IServer {
name: string;
iconURL: string;
useRealName: boolean;
FileUpload_MediaTypeWhiteList: string;
FileUpload_MaxFileSize: number;
roomsUpdatedAt: Date;
version: string;
lastLocalAuthenticatedSession: Date;
autoLock: boolean;
autoLockTime: number | null;
biometry: boolean | null;
uniqueID: string;
enterpriseModules: string;
E2E_Enable: boolean;
}
File renamed without changes.
2 changes: 1 addition & 1 deletion app/dimensions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface IDimensionsContextProps {

export const DimensionsContext = React.createContext<Partial<IDimensionsContextProps>>(Dimensions.get('window'));

export function withDimensions(Component: any) {
export function withDimensions(Component: any): any {
const DimensionsComponent = (props: any) => (
<DimensionsContext.Consumer>{contexts => <Component {...props} {...contexts} />}</DimensionsContext.Consumer>
);
Expand Down
1 change: 1 addition & 0 deletions app/ee/omnichannel/views/QueueListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,5 @@ const mapStateToProps = state => ({
showAvatar: state.sortPreferences.showAvatar,
displayMode: state.sortPreferences.displayMode
});

export default connect(mapStateToProps)(withDimensions(withTheme(QueueListView)));
2 changes: 1 addition & 1 deletion app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { selectServerFailure } from '../actions/server';
import { useSsl } from '../utils/url';
import EventEmitter from '../utils/events';
import { updatePermission } from '../actions/permissions';
import { TEAM_TYPE } from '../definition/ITeam';
import { TEAM_TYPE } from '../definitions/ITeam';
import { updateSettings } from '../actions/settings';
import { compareServerVersion, methods } from './utils';
import reduxStore from './createStore';
Expand Down
45 changes: 45 additions & 0 deletions app/navigationTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { NavigatorScreenParams } from '@react-navigation/core';

import { IRoom } from './definitions/IRoom';
import { IServer } from './definitions/IServer';
import { IAttachment } from './definitions/IAttachment';
import { MasterDetailInsideStackParamList } from './stacks/MasterDetailStack/types';
import { OutsideParamList, InsideStackParamList } from './stacks/types';

export type SetUsernameStackParamList = {
SetUsernameView: {
title: string;
};
};

export type StackParamList = {
AuthLoading: undefined;
OutsideStack: NavigatorScreenParams<OutsideParamList>;
InsideStack: NavigatorScreenParams<InsideStackParamList>;
MasterDetailStack: NavigatorScreenParams<MasterDetailInsideStackParamList>;
SetUsernameStack: NavigatorScreenParams<SetUsernameStackParamList>;
};

export type ShareInsideStackParamList = {
ShareListView: undefined;
ShareView: {
attachments: IAttachment[];
isShareView?: boolean;
isShareExtension: boolean;
serverInfo: IServer;
text: string;
room: IRoom;
thread: any; // TODO: Change
};
SelectServerView: undefined;
};

export type ShareOutsideStackParamList = {
WithoutServersView: undefined;
};

export type ShareAppStackParamList = {
AuthLoading?: undefined;
OutsideStack?: NavigatorScreenParams<ShareOutsideStackParamList>;
InsideStack?: NavigatorScreenParams<ShareInsideStackParamList>;
};
16 changes: 6 additions & 10 deletions app/share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { setCurrentScreen } from './utils/log';
import AuthLoadingView from './views/AuthLoadingView';
import { DimensionsContext } from './dimensions';
import debounce from './utils/debounce';
import { ShareInsideStackParamList, ShareOutsideStackParamList, ShareAppStackParamList } from './navigationTypes';

interface IDimensions {
width: number;
Expand All @@ -46,7 +47,7 @@ interface IState {
fontScale: number;
}

const Inside = createStackNavigator();
const Inside = createStackNavigator<ShareInsideStackParamList>();
const InsideStack = () => {
const { theme } = useContext(ThemeContext);

Expand All @@ -65,24 +66,19 @@ const InsideStack = () => {
);
};

const Outside = createStackNavigator();
const Outside = createStackNavigator<ShareOutsideStackParamList>();
const OutsideStack = () => {
const { theme } = useContext(ThemeContext);

return (
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme) }}>
<Outside.Screen
name='WithoutServersView'
component={WithoutServersView}
/* @ts-ignore*/
options={WithoutServersView.navigationOptions}
/>
<Outside.Screen name='WithoutServersView' component={WithoutServersView} options={WithoutServersView.navigationOptions} />
</Outside.Navigator>
);
};

// App
const Stack = createStackNavigator();
const Stack = createStackNavigator<ShareAppStackParamList>();
export const App = ({ root }: any) => (
<Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}>
<>
Expand Down Expand Up @@ -112,7 +108,7 @@ class Root extends React.Component<{}, IState> {
this.init();
}

componentWillUnmount() {
componentWillUnmount(): void {
RocketChat.closeShareExtension();
unsubscribeTheme();
}
Expand Down
Loading