diff --git a/.circleci/config.yml b/.circleci/config.yml index 579d126df..2b9fba2ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -190,11 +190,6 @@ jobs: name: Restore NPM cache key: node-modules-{{ checksum "yarn.lock" }} - - run: - name: Install React Native CLI - command: | - npm i -g react-native-cli - - run: name: Install NPM modules command: | @@ -308,7 +303,6 @@ jobs: - run: name: Install NPM modules command: | - yarn global add react-native react-native-cli yarn - run: diff --git a/README.md b/README.md index 392aa0700..bcae9f99d 100644 --- a/README.md +++ b/README.md @@ -56,16 +56,15 @@ Follow the [React Native Getting Started Guide](https://facebook.github.io/react ```bash $ git clone git@github.com:RocketChat/Rocket.Chat.ReactNative.git $ cd Rocket.Chat.ReactNative - $ yarn global add react-native-cli $ yarn ``` - Run application ```bash - $ react-native run-ios + $ npx react-native run-ios ``` ```bash - $ react-native run-android + $ npx react-native run-android ``` ### Running single server @@ -81,7 +80,7 @@ Readme will guide you on how to config. |--------------------------------------------------------------- |-------- | | Jitsi Integration | ✅ | | Federation (Directory) | ✅ | -| Discussions | ❌ | +| Discussions | ✅ | | Omnichannel | ❌ | | Threads | ✅ | | Record Audio | ✅ | diff --git a/__mocks__/@rocket.chat/sdk.js b/__mocks__/@rocket.chat/sdk.js new file mode 100644 index 000000000..b469d9125 --- /dev/null +++ b/__mocks__/@rocket.chat/sdk.js @@ -0,0 +1,2 @@ +export class Rocketchat {} +export const settings = {}; diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index 758bf7345..2fa6d1061 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -3751,9 +3751,9 @@ exports[`Storyshots Message list message 1`] = ` resizeMode="cover" source={ Object { - "headers": Object {}, + "headers": undefined, "priority": "high", - "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&width=50&height=50&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", + "uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=50&&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz&rc_uid=y8bd77ptZswPj3EW8", } } style={ @@ -3792,33 +3792,51 @@ exports[`Storyshots Message list message 1`] = ` } > - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - + + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + + - - diego.mello - + + diego.mello + + - - Diego Mello - @ - diego.mello + Diego Mello + + @ + diego.mello + - + - - Diego Mello - @ - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + Diego Mello + + @ + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + - + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - Diego Mello - + + Diego Mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - rocket.cat - + + rocket.cat + + - - diego.mello - + + diego.mello + + - - rocket.cat - + + rocket.cat + + - - diego.mello - + + diego.mello + + - - rocket.cat - + + rocket.cat + + - - diego.mello - + + diego.mello + + - - rocket.cat - + + rocket.cat + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + - - diego.mello - + + diego.mello + + + + + + + + + + + diff --git a/android/app/src/main/res/drawable-xhdpi/logo.png b/android/app/src/main/res/drawable-xhdpi/logo.png old mode 100644 new mode 100755 index e4502f69c..3e85a65d2 Binary files a/android/app/src/main/res/drawable-xhdpi/logo.png and b/android/app/src/main/res/drawable-xhdpi/logo.png differ diff --git a/android/app/src/main/res/drawable-xhdpi/logo_onboarding.png b/android/app/src/main/res/drawable-xhdpi/logo_onboarding.png deleted file mode 100644 index bf3e6a526..000000000 Binary files a/android/app/src/main/res/drawable-xhdpi/logo_onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xhdpi/new_server.png b/android/app/src/main/res/drawable-xhdpi/new_server.png deleted file mode 100644 index 4b1e11cb4..000000000 Binary files a/android/app/src/main/res/drawable-xhdpi/new_server.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xhdpi/onboarding.png b/android/app/src/main/res/drawable-xhdpi/onboarding.png deleted file mode 100644 index 67764cd13..000000000 Binary files a/android/app/src/main/res/drawable-xhdpi/onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xhdpi/options.png b/android/app/src/main/res/drawable-xhdpi/options.png deleted file mode 100644 index 612d02be8..000000000 Binary files a/android/app/src/main/res/drawable-xhdpi/options.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxhdpi/logo.png b/android/app/src/main/res/drawable-xxhdpi/logo.png old mode 100644 new mode 100755 index 159d7d4a5..a13087a4e Binary files a/android/app/src/main/res/drawable-xxhdpi/logo.png and b/android/app/src/main/res/drawable-xxhdpi/logo.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/logo_onboarding.png b/android/app/src/main/res/drawable-xxhdpi/logo_onboarding.png deleted file mode 100644 index a95427d0a..000000000 Binary files a/android/app/src/main/res/drawable-xxhdpi/logo_onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxhdpi/new_server.png b/android/app/src/main/res/drawable-xxhdpi/new_server.png deleted file mode 100644 index 5c1b8fb5e..000000000 Binary files a/android/app/src/main/res/drawable-xxhdpi/new_server.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxhdpi/onboarding.png b/android/app/src/main/res/drawable-xxhdpi/onboarding.png deleted file mode 100644 index fa8a8d2e8..000000000 Binary files a/android/app/src/main/res/drawable-xxhdpi/onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxhdpi/options.png b/android/app/src/main/res/drawable-xxhdpi/options.png deleted file mode 100644 index 2622837a8..000000000 Binary files a/android/app/src/main/res/drawable-xxhdpi/options.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/logo.png b/android/app/src/main/res/drawable-xxxhdpi/logo.png old mode 100644 new mode 100755 index c1bd0fe37..8adfb1674 Binary files a/android/app/src/main/res/drawable-xxxhdpi/logo.png and b/android/app/src/main/res/drawable-xxxhdpi/logo.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/logo_onboarding.png b/android/app/src/main/res/drawable-xxxhdpi/logo_onboarding.png deleted file mode 100644 index df1c5467f..000000000 Binary files a/android/app/src/main/res/drawable-xxxhdpi/logo_onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/new_server.png b/android/app/src/main/res/drawable-xxxhdpi/new_server.png deleted file mode 100644 index 8a45bca89..000000000 Binary files a/android/app/src/main/res/drawable-xxxhdpi/new_server.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/onboarding.png b/android/app/src/main/res/drawable-xxxhdpi/onboarding.png deleted file mode 100644 index eaa2a3bcf..000000000 Binary files a/android/app/src/main/res/drawable-xxxhdpi/onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/options.png b/android/app/src/main/res/drawable-xxxhdpi/options.png deleted file mode 100644 index f9a4f0213..000000000 Binary files a/android/app/src/main/res/drawable-xxxhdpi/options.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000..c4a603d4c --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 000000000..c4a603d4c --- /dev/null +++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index 427ab384b..283cd03d7 100755 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..22ba3f90c Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 000000000..b5e406531 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 874d548a6..7058008e3 100755 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..63495400d Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 000000000..3296da8bc Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 459fa34d0..27fe2a7e9 100755 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..707e83311 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 000000000..6a05faa33 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 91be92cc1..84884b9e3 100755 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..bc656a040 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..d1a0abb0e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index e0cfa5e34..4b60c7eb8 100755 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..4eeb42539 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..02cec6d94 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index afec33cb3..e8e7ca8c1 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,5 +1,4 @@ Rocket.Chat Experimental Rocket.Chat Experimental - No Browser Found diff --git a/app/actions/actionsTypes.js b/app/actions/actionsTypes.js index bf07a329d..33e202a56 100644 --- a/app/actions/actionsTypes.js +++ b/app/actions/actionsTypes.js @@ -31,10 +31,11 @@ export const ROOMS = createRequestTypes('ROOMS', [ 'OPEN_SEARCH_HEADER', 'CLOSE_SEARCH_HEADER' ]); -export const ROOM = createRequestTypes('ROOM', ['LEAVE', 'DELETE_INIT', 'DELETE_FINISH', 'USER_TYPING']); +export const ROOM = createRequestTypes('ROOM', ['LEAVE', 'DELETE', 'REMOVED', 'USER_TYPING']); export const APP = createRequestTypes('APP', ['START', 'READY', 'INIT', 'INIT_LOCAL_SETTINGS']); export const MESSAGES = createRequestTypes('MESSAGES', ['REPLY_BROADCAST']); export const CREATE_CHANNEL = createRequestTypes('CREATE_CHANNEL', [...defaultTypes]); +export const CREATE_DISCUSSION = createRequestTypes('CREATE_DISCUSSION', [...defaultTypes]); export const SELECTED_USERS = createRequestTypes('SELECTED_USERS', ['ADD_USER', 'REMOVE_USER', 'RESET', 'SET_LOADING']); export const SERVER = createRequestTypes('SERVER', [ ...defaultTypes, @@ -62,3 +63,4 @@ export const INVITE_LINKS = createRequestTypes('INVITE_LINKS', [ 'CLEAR', ...defaultTypes ]); +export const SETTINGS = createRequestTypes('SETTINGS', ['CLEAR', 'ADD']); diff --git a/app/actions/createDiscussion.js b/app/actions/createDiscussion.js new file mode 100644 index 000000000..5b6faa851 --- /dev/null +++ b/app/actions/createDiscussion.js @@ -0,0 +1,22 @@ +import * as types from './actionsTypes'; + +export function createDiscussionRequest(data) { + return { + type: types.CREATE_DISCUSSION.REQUEST, + data + }; +} + +export function createDiscussionSuccess(data) { + return { + type: types.CREATE_DISCUSSION.SUCCESS, + data + }; +} + +export function createDiscussionFailure(err) { + return { + type: types.CREATE_DISCUSSION.FAILURE, + err + }; +} diff --git a/app/actions/index.js b/app/actions/index.js index 7943fd9d0..9527cac88 100644 --- a/app/actions/index.js +++ b/app/actions/index.js @@ -34,13 +34,6 @@ export function setCurrentServer(server) { }; } -export function addSettings(settings) { - return { - type: types.ADD_SETTINGS, - payload: settings - }; -} - export function login() { return { type: 'LOGIN' diff --git a/app/actions/room.js b/app/actions/room.js index 8d4e17e96..76a37b656 100644 --- a/app/actions/room.js +++ b/app/actions/room.js @@ -8,17 +8,17 @@ export function leaveRoom(rid, t) { }; } -export function deleteRoomInit(rid, t) { +export function deleteRoom(rid, t) { return { - type: types.ROOM.DELETE_INIT, + type: types.ROOM.DELETE, rid, t }; } -export function deleteRoomFinish() { +export function removedRoom() { return { - type: types.ROOM.DELETE_FINISH + type: types.ROOM.REMOVED }; } diff --git a/app/actions/settings.js b/app/actions/settings.js new file mode 100644 index 000000000..381958c54 --- /dev/null +++ b/app/actions/settings.js @@ -0,0 +1,14 @@ +import { SETTINGS } from './actionsTypes'; + +export function addSettings(settings) { + return { + type: SETTINGS.ADD, + payload: settings + }; +} + +export function clearSettings() { + return { + type: SETTINGS.CLEAR + }; +} diff --git a/app/constants/settings.js b/app/constants/settings.js index 513ff5f34..5287367fb 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -14,6 +14,9 @@ export default { Accounts_AllowUserProfileChange: { type: 'valueAsBoolean' }, + Accounts_AllowUserStatusMessageChange: { + type: 'valueAsBoolean' + }, Accounts_AllowUsernameChange: { type: 'valueAsBoolean' }, @@ -44,9 +47,18 @@ export default { Accounts_ShowFormLogin: { type: 'valueAsBoolean' }, + Accounts_ManuallyApproveNewUsers: { + type: 'valueAsBoolean' + }, CROWD_Enable: { type: 'valueAsBoolean' }, + DirectMesssage_maxUsers: { + type: 'valueAsNumber' + }, + Accounts_Directory_DefaultView: { + type: 'valueAsString' + }, FEDERATION_Enabled: { type: 'valueAsBoolean' }, diff --git a/app/constants/tablet.js b/app/constants/tablet.js index 16e62f6d0..93f53d846 100644 --- a/app/constants/tablet.js +++ b/app/constants/tablet.js @@ -1,4 +1,4 @@ export const MAX_SIDEBAR_WIDTH = 321; export const MAX_CONTENT_WIDTH = '90%'; -export const MAX_SCREEN_CONTENT_WIDTH = '45%'; +export const MAX_SCREEN_CONTENT_WIDTH = '50%'; export const MIN_WIDTH_SPLIT_LAYOUT = 700; diff --git a/app/constants/types.js b/app/constants/types.js index 0a7ec86c8..d6bc3731d 100644 --- a/app/constants/types.js +++ b/app/constants/types.js @@ -1,3 +1,4 @@ export const SET_CURRENT_SERVER = 'SET_CURRENT_SERVER'; export const SET_CUSTOM_EMOJIS = 'SET_CUSTOM_EMOJIS'; export const ADD_SETTINGS = 'ADD_SETTINGS'; +export const CLEAR_SETTINGS = 'CLEAR_SETTINGS'; diff --git a/app/containers/AppVersion.js b/app/containers/AppVersion.js new file mode 100644 index 000000000..2e679d968 --- /dev/null +++ b/app/containers/AppVersion.js @@ -0,0 +1,34 @@ +import React from 'react'; +import { StyleSheet, View, Text } from 'react-native'; +import PropTypes from 'prop-types'; + +import { themes } from '../constants/colors'; +import sharedStyles from '../views/Styles'; +import { getReadableVersion } from '../utils/deviceInfo'; +import I18n from '../i18n'; + +const styles = StyleSheet.create({ + container: { + alignItems: 'center', + justifyContent: 'flex-end' + }, + text: { + ...sharedStyles.textRegular, + fontSize: 13 + }, + bold: { + ...sharedStyles.textSemibold + } +}); + +const AppVersion = React.memo(({ theme }) => ( + + {I18n.t('Version_no', { version: '' })}{getReadableVersion} + +)); + +AppVersion.propTypes = { + theme: PropTypes.string +}; + +export default AppVersion; diff --git a/app/containers/Avatar.js b/app/containers/Avatar.js index c951fd23f..2e4aa5353 100644 --- a/app/containers/Avatar.js +++ b/app/containers/Avatar.js @@ -4,10 +4,7 @@ import { View } from 'react-native'; import FastImage from 'react-native-fast-image'; import { settings as RocketChatSettings } from '@rocket.chat/sdk'; import Touch from '../utils/touch'; - -const formatUrl = (url, baseUrl, uriSize, avatarAuthURLFragment) => ( - `${ baseUrl }${ url }?format=png&width=${ uriSize }&height=${ uriSize }${ avatarAuthURLFragment }` -); +import { avatarURL } from '../utils/avatar'; const Avatar = React.memo(({ text, size, baseUrl, borderRadius, style, avatar, type, children, userId, token, onPress, theme @@ -22,24 +19,9 @@ const Avatar = React.memo(({ return null; } - const room = type === 'd' ? text : `@${ text }`; - - // Avoid requesting several sizes by having only two sizes on cache - const uriSize = size === 100 ? 100 : 50; - - let avatarAuthURLFragment = ''; - if (userId && token) { - avatarAuthURLFragment = `&rc_token=${ token }&rc_uid=${ userId }`; - } - - - let uri; - if (avatar) { - uri = avatar.includes('http') ? avatar : formatUrl(avatar, baseUrl, uriSize, avatarAuthURLFragment); - } else { - uri = formatUrl(`/avatar/${ room }`, baseUrl, uriSize, avatarAuthURLFragment); - } - + const uri = avatarURL({ + type, text, size, userId, token, avatar, baseUrl + }); let image = ( { loading - ? + ? : ( {title} diff --git a/app/containers/Check.js b/app/containers/Check.js index e3f4f5147..e9a6b73b8 100644 --- a/app/containers/Check.js +++ b/app/containers/Check.js @@ -13,9 +13,10 @@ const styles = StyleSheet.create({ } }); -const Check = React.memo(({ theme }) => ); +const Check = React.memo(({ theme, style }) => ); Check.propTypes = { + style: PropTypes.object, theme: PropTypes.string }; diff --git a/app/containers/EmojiPicker/styles.js b/app/containers/EmojiPicker/styles.js index f7fdbfdef..f6278dd1a 100644 --- a/app/containers/EmojiPicker/styles.js +++ b/app/containers/EmojiPicker/styles.js @@ -47,7 +47,8 @@ export default StyleSheet.create({ }, categoryEmoji: { backgroundColor: 'transparent', - textAlign: 'center' + textAlign: 'center', + color: '#ffffff' }, customCategoryEmoji: { margin: 8 diff --git a/app/containers/FormContainer.js b/app/containers/FormContainer.js new file mode 100644 index 000000000..fda039765 --- /dev/null +++ b/app/containers/FormContainer.js @@ -0,0 +1,51 @@ +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'; +import scrollPersistTaps from '../utils/scrollPersistTaps'; +import KeyboardView from '../presentation/KeyboardView'; +import StatusBar from './StatusBar'; +import AppVersion from './AppVersion'; +import { isTablet } from '../utils/deviceInfo'; + +const styles = StyleSheet.create({ + scrollView: { + minHeight: '100%' + } +}); + +export const FormContainerInner = ({ children }) => ( + + {children} + +); + +const FormContainer = ({ children, theme }) => ( + + + + + {children} + + + + +); + +FormContainer.propTypes = { + theme: PropTypes.string, + children: PropTypes.element +}; + +FormContainerInner.propTypes = { + children: PropTypes.element +}; + +export default FormContainer; diff --git a/app/containers/HeaderButton.js b/app/containers/HeaderButton.js index e13ca4398..7cb5375f1 100644 --- a/app/containers/HeaderButton.js +++ b/app/containers/HeaderButton.js @@ -36,13 +36,13 @@ export const DrawerButton = React.memo(({ navigation, testID, ...otherProps }) = )); -export const CloseModalButton = React.memo(({ navigation, testID }) => ( +export const CloseModalButton = React.memo(({ navigation, testID, onPress = () => navigation.pop() }) => ( - navigation.pop()} testID={testID} /> + )); -export const CloseShareExtensionButton = React.memo(({ onPress, testID }) => ( +export const CancelModalButton = React.memo(({ onPress, testID }) => ( {isIOS ? @@ -76,9 +76,10 @@ DrawerButton.propTypes = { }; CloseModalButton.propTypes = { navigation: PropTypes.object.isRequired, - testID: PropTypes.string.isRequired + testID: PropTypes.string.isRequired, + onPress: PropTypes.func }; -CloseShareExtensionButton.propTypes = { +CancelModalButton.propTypes = { onPress: PropTypes.func.isRequired, testID: PropTypes.string.isRequired }; diff --git a/app/containers/ListItem.js b/app/containers/ListItem.js index dcdaa6585..6b7498dd8 100644 --- a/app/containers/ListItem.js +++ b/app/containers/ListItem.js @@ -33,9 +33,10 @@ const styles = StyleSheet.create({ }); const Content = React.memo(({ - title, subtitle, disabled, testID, right, color, theme + title, subtitle, disabled, testID, left, right, color, theme }) => ( + {left ? left() : null} {title} {subtitle @@ -51,7 +52,7 @@ const Button = React.memo(({ onPress, ...props }) => ( onPress(props.title)} style={{ backgroundColor: themes[props.theme].backgroundColor }} enabled={!props.disabled} theme={props.theme} @@ -79,6 +80,7 @@ Item.propTypes = { Content.propTypes = { title: PropTypes.string.isRequired, subtitle: PropTypes.string, + left: PropTypes.func, right: PropTypes.func, disabled: PropTypes.bool, testID: PropTypes.string, @@ -87,6 +89,7 @@ Content.propTypes = { }; Button.propTypes = { + title: PropTypes.string, onPress: PropTypes.func, disabled: PropTypes.bool, theme: PropTypes.string diff --git a/app/views/LoginSignupView.js b/app/containers/LoginServices.js similarity index 58% rename from app/views/LoginSignupView.js rename to app/containers/LoginServices.js index d3c5bb288..e6e685b34 100644 --- a/app/views/LoginSignupView.js +++ b/app/containers/LoginServices.js @@ -1,42 +1,32 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { - Text, View, ScrollView, Image, StyleSheet, Animated, Easing + View, StyleSheet, Text, Animated, Easing, Image } from 'react-native'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Base64 } from 'js-base64'; -import { SafeAreaView } from 'react-navigation'; -import { BorderlessButton } from 'react-native-gesture-handler'; -import equal from 'deep-equal'; +import { withNavigation } from 'react-navigation'; -import Touch from '../utils/touch'; -import sharedStyles from './Styles'; -import scrollPersistTaps from '../utils/scrollPersistTaps'; -import random from '../utils/random'; -import Button from '../containers/Button'; -import I18n from '../i18n'; -import { LegalButton } from '../containers/HeaderButton'; -import StatusBar from '../containers/StatusBar'; -import { themes } from '../constants/colors'; import { withTheme } from '../theme'; -import { themedHeader } from '../utils/navigation'; -import { isTablet } from '../utils/deviceInfo'; +import sharedStyles from '../views/Styles'; +import { themes } from '../constants/colors'; +import { loginRequest as loginRequestAction } from '../actions/login'; +import Button from './Button'; +import OnboardingSeparator from './OnboardingSeparator'; +import Touch from '../utils/touch'; +import I18n from '../i18n'; +import random from '../utils/random'; + +const SERVICE_HEIGHT = 58; +const SERVICES_COLLAPSED_HEIGHT = 174; const styles = StyleSheet.create({ - container: { - paddingVertical: 30 - }, - safeArea: { - paddingBottom: 30, - flex: 1 - }, serviceButton: { borderRadius: 2, marginBottom: 10 }, serviceButtonContainer: { borderRadius: 2, - borderWidth: 1, width: '100%', height: 48, flexDirection: 'row', @@ -56,124 +46,32 @@ const styles = StyleSheet.create({ fontSize: 16 }, serviceName: { - ...sharedStyles.textBold + ...sharedStyles.textSemibold }, - registerDisabled: { - ...sharedStyles.textRegular, - ...sharedStyles.textAlignCenter, - fontSize: 16 - }, - servicesTogglerContainer: { - flexDirection: 'row', - alignItems: 'center', - marginTop: 5, - marginBottom: 30 - }, - servicesToggler: { - width: 32, - height: 31 - }, - separatorContainer: { - marginTop: 5, - marginBottom: 15 - }, - separatorLine: { - flex: 1, - height: 1 - }, - separatorLineLeft: { - marginRight: 15 - }, - separatorLineRight: { - marginLeft: 15 - }, - inverted: { - transform: [{ scaleY: -1 }] + options: { + marginBottom: 0 } }); -const SERVICE_HEIGHT = 58; -const SERVICES_COLLAPSED_HEIGHT = 174; - -class LoginSignupView extends React.Component { - static navigationOptions = ({ navigation, screenProps }) => { - const title = navigation.getParam('title', 'Rocket.Chat'); - return { - ...themedHeader(screenProps.theme), - title, - headerRight: - }; - } - +class LoginServices extends React.PureComponent { static propTypes = { navigation: PropTypes.object, server: PropTypes.string, services: PropTypes.object, - Site_Name: PropTypes.string, Gitlab_URL: PropTypes.string, CAS_enabled: PropTypes.bool, CAS_login_url: PropTypes.string, - Accounts_ShowFormLogin: PropTypes.bool, - Accounts_RegistrationForm: PropTypes.string, - Accounts_RegistrationForm_LinkReplacementText: PropTypes.string, + separator: PropTypes.bool, theme: PropTypes.string } - constructor(props) { - super(props); - this.state = { - collapsed: true, - servicesHeight: new Animated.Value(SERVICES_COLLAPSED_HEIGHT) - }; - const { Site_Name } = this.props; - this.setTitle(Site_Name); + static defaultProps = { + separator: true } - shouldComponentUpdate(nextProps, nextState) { - const { collapsed, servicesHeight } = this.state; - const { - server, Site_Name, services, Accounts_ShowFormLogin, Accounts_RegistrationForm, Accounts_RegistrationForm_LinkReplacementText, theme - } = this.props; - if (nextState.collapsed !== collapsed) { - return true; - } - if (nextState.servicesHeight !== servicesHeight) { - return true; - } - if (nextProps.server !== server) { - return true; - } - if (nextProps.Site_Name !== Site_Name) { - return true; - } - if (nextProps.theme !== theme) { - return true; - } - if (nextProps.Accounts_ShowFormLogin !== Accounts_ShowFormLogin) { - return true; - } - if (nextProps.Accounts_RegistrationForm !== Accounts_RegistrationForm) { - return true; - } - if (nextProps.Accounts_RegistrationForm_LinkReplacementText !== Accounts_RegistrationForm_LinkReplacementText) { - return true; - } - if (!equal(nextProps.services, services)) { - return true; - } - return false; - } - - componentDidUpdate(prevProps) { - const { Site_Name } = this.props; - if (Site_Name && prevProps.Site_Name !== Site_Name) { - this.setTitle(Site_Name); - } - } - - setTitle = (title) => { - const { navigation } = this.props; - navigation.setParams({ title }); + state = { + collapsed: true, + servicesHeight: new Animated.Value(SERVICES_COLLAPSED_HEIGHT) } onPressFacebook = () => { @@ -224,9 +122,9 @@ class LoginSignupView extends React.Component { onPressLinkedin = () => { const { services, server } = this.props; const { clientId } = services.linkedin; - const endpoint = 'https://www.linkedin.com/uas/oauth2/authorization'; + const endpoint = 'https://www.linkedin.com/oauth/v2/authorization'; const redirect_uri = `${ server }/_oauth/linkedin?close`; - const scope = 'r_emailaddress'; + const scope = 'r_liteprofile,r_emailaddress'; const state = this.getOAuthState(); const params = `?client_id=${ clientId }&redirect_uri=${ redirect_uri }&scope=${ scope }&state=${ state }&response_type=code`; this.openOAuth({ url: `${ endpoint }${ params }` }); @@ -300,16 +198,6 @@ class LoginSignupView extends React.Component { navigation.navigate('AuthenticationWebView', { url, authType, ssoToken }); } - login = () => { - const { navigation, Site_Name } = this.props; - navigation.navigate('LoginView', { title: Site_Name }); - } - - register = () => { - const { navigation, Site_Name } = this.props; - navigation.navigate('RegisterView', { title: Site_Name }); - } - transitionServicesTo = (height) => { const { servicesHeight } = this.state; if (this._animation) { @@ -350,27 +238,28 @@ class LoginSignupView extends React.Component { renderServicesSeparator = () => { const { collapsed } = this.state; - const { - services, theme, Accounts_ShowFormLogin, Accounts_RegistrationForm - } = this.props; + const { services, separator, theme } = this.props; const { length } = Object.values(services); - if (length > 3 && Accounts_ShowFormLogin && Accounts_RegistrationForm) { + if (length > 3 && separator) { return ( - - - - - - - + <> +