Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
OtavioStasiak committed Oct 18, 2024
1 parent f916332 commit 203b7ad
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Text, TouchableOpacity, View } from 'react-native';
import I18n from 'i18n-js';

import { themes } from '../../../../lib/constants';
import { TCertificatePicker } from '../../types';
import { TCertificatePicker } from '../../definitions';
import { isAndroid, isTablet } from '../../../../lib/methods/helpers';
import styles from './styles';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,24 @@ export interface INewServerViewProps extends IBaseScreen<OutsideParamList, 'NewS
previousServer: string | null;
};

export type TNewServerViewState = {
text: string;
connectingOpen: boolean;
certificate: string | null;
serversHistory: TServerHistoryModel[];
};

export type TSubmitParams = {
export interface ISubmitParams {
fromServerHistory?: boolean;
username?: string;
serverUrl?: string;
};

export type INewServerAction =
| { type: 'SET_TEXT'; payload: string }
| { type: 'SET_CONNECTING_OPEN'; payload: boolean }
| { type: 'SET_CERTIFICATE'; payload: string | null }
| { type: 'SET_SERVERS_HISTORY'; payload: TServerHistoryModel[] }
| {type: 'DELETE_SERVER_FROM_HISTORY'; payload: string};


export type TCertificatePicker = {
export interface TCertificatePicker {
previousServer: string | null;
certificate: string | null;
theme: TSupportedThemes;
handleRemove: () => void;
chooseCertificate: () => Promise<void>;
};

export type TNewServerAction =
| { type: 'SET_TEXT'; payload: string }
| { type: 'SET_CONNECTING_OPEN'; payload: boolean }
| { type: 'SET_CERTIFICATE'; payload: string | null }
| { type: 'SET_SERVERS_HISTORY'; payload: TServerHistoryModel[] }
| {type: 'DELETE_SERVER_FROM_HISTORY'; payload: string};

4 changes: 2 additions & 2 deletions app/views/NewServerView/hooks/useConnectServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { serverRequest } from '../../../actions/server';
import { BASIC_AUTH_KEY, setBasicAuth } from '../../../lib/methods/helpers/fetch';
import { CERTIFICATE_KEY } from '../../../lib/constants';
import completeUrl from '../utils/completeUrl';
import { TSubmitParams } from '../types';
import { ISubmitParams } from '../definitions';

type TUseNewServerProps = {
text: string;
Expand Down Expand Up @@ -40,7 +40,7 @@ const useConnectServer = ({ text, certificate }: TUseNewServerProps) => {
dispatch(serverRequest('https://open.rocket.chat'));
};

const submit = ({ fromServerHistory = false, username, serverUrl }: TSubmitParams = {}) => {
const submit = ({ fromServerHistory = false, username, serverUrl }: ISubmitParams = {}) => {
logEvent(events.NS_CONNECT_TO_WORKSPACE);

setConnectingOpen(false);
Expand Down
2 changes: 1 addition & 1 deletion app/views/NewServerView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import useServersHistory from './hooks/useServersHistory';
import useCertificate from './hooks/useCertificate';
import useNewServer from './hooks/useConnectServer';
import completeUrl from './utils/completeUrl';
import { INewServerViewProps } from './types';
import { INewServerViewProps } from './definitions';
import styles from './styles';

const NewServerView = ({ navigation }: INewServerViewProps) => {
Expand Down

0 comments on commit 203b7ad

Please sign in to comment.