diff --git a/.circleci/config.yml b/.circleci/config.yml index 579d126df0..2b9fba2ede 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 392aa07009..bcae9f99d1 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 0000000000..b469d91250 --- /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 758bf73457..2fa6d10612 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 + + #660B0B0B \ No newline at end of file diff --git a/android/app/src/debug/res/values/strings.xml b/android/app/src/debug/res/values/strings.xml index 631d28ea8a..207352c2a8 100644 --- a/android/app/src/debug/res/values/strings.xml +++ b/android/app/src/debug/res/values/strings.xml @@ -1,5 +1,4 @@ - [DEVELOP] RocketChatRN - - No Browser Found + [DEBUG] Rocket.Chat Experimental + [DEBUG] Rocket.Chat Experimental diff --git a/android/app/src/debug/res/values/styles.xml b/android/app/src/debug/res/values/styles.xml deleted file mode 100644 index 654ec9502b..0000000000 --- a/android/app/src/debug/res/values/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/android/app/src/main/ic_launcher-web.png b/android/app/src/main/ic_launcher-web.png new file mode 100644 index 0000000000..469e3e31ed Binary files /dev/null and b/android/app/src/main/ic_launcher-web.png differ diff --git a/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java b/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java index dd20226872..17002faa0b 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java +++ b/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java @@ -237,12 +237,19 @@ private void notificationStyle(Notification.Builder notification, int notId, Bun if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { messageStyle.addMessage(m, timestamp, username); } else { - Person sender = new Person.Builder() + Bitmap avatar = getAvatar(avatarUri); + + Person.Builder sender = new Person.Builder() .setKey(senderId) - .setName(username) - .setIcon(Icon.createWithBitmap(getAvatar(avatarUri))) - .build(); - messageStyle.addMessage(m, timestamp, sender); + .setName(username); + + if (avatar != null) { + sender.setIcon(Icon.createWithBitmap(avatar)); + } + + Person person = sender.build(); + + messageStyle.addMessage(m, timestamp, person); } } } diff --git a/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java b/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java index f408e11cd7..de66369a13 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java +++ b/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java @@ -14,7 +14,7 @@ public class MainActivity extends ReactFragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - RNBootSplash.show(R.drawable.launch_screen, MainActivity.this); + RNBootSplash.init(R.drawable.launch_screen, MainActivity.this); } /** diff --git a/android/app/src/main/res/drawable-hdpi/logo.png b/android/app/src/main/res/drawable-hdpi/logo.png old mode 100644 new mode 100755 index 4a98ac0646..6d56e9f5d6 Binary files a/android/app/src/main/res/drawable-hdpi/logo.png and b/android/app/src/main/res/drawable-hdpi/logo.png differ diff --git a/android/app/src/main/res/drawable-hdpi/logo_onboarding.png b/android/app/src/main/res/drawable-hdpi/logo_onboarding.png deleted file mode 100644 index 069c9ce8db..0000000000 Binary files a/android/app/src/main/res/drawable-hdpi/logo_onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-hdpi/new_server.png b/android/app/src/main/res/drawable-hdpi/new_server.png deleted file mode 100644 index fae62c0e0c..0000000000 Binary files a/android/app/src/main/res/drawable-hdpi/new_server.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-hdpi/onboarding.png b/android/app/src/main/res/drawable-hdpi/onboarding.png deleted file mode 100644 index f1228b3f19..0000000000 Binary files a/android/app/src/main/res/drawable-hdpi/onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-hdpi/options.png b/android/app/src/main/res/drawable-hdpi/options.png deleted file mode 100644 index 8e3bcc2ca4..0000000000 Binary files a/android/app/src/main/res/drawable-hdpi/options.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-mdpi/logo.png b/android/app/src/main/res/drawable-mdpi/logo.png old mode 100644 new mode 100755 index 6928d7b88b..375dae9ccd Binary files a/android/app/src/main/res/drawable-mdpi/logo.png and b/android/app/src/main/res/drawable-mdpi/logo.png differ diff --git a/android/app/src/main/res/drawable-mdpi/logo_onboarding.png b/android/app/src/main/res/drawable-mdpi/logo_onboarding.png deleted file mode 100644 index a5fcdfbcaa..0000000000 Binary files a/android/app/src/main/res/drawable-mdpi/logo_onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-mdpi/new_server.png b/android/app/src/main/res/drawable-mdpi/new_server.png deleted file mode 100644 index ea8e06f9b8..0000000000 Binary files a/android/app/src/main/res/drawable-mdpi/new_server.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-mdpi/onboarding.png b/android/app/src/main/res/drawable-mdpi/onboarding.png deleted file mode 100644 index 55656e242d..0000000000 Binary files a/android/app/src/main/res/drawable-mdpi/onboarding.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-mdpi/options.png b/android/app/src/main/res/drawable-mdpi/options.png deleted file mode 100644 index a2bd9ecdf3..0000000000 Binary files a/android/app/src/main/res/drawable-mdpi/options.png and /dev/null differ diff --git a/android/app/src/main/res/drawable-v24/ic_launcher_background.xml b/android/app/src/main/res/drawable-v24/ic_launcher_background.xml new file mode 100644 index 0000000000..6e2c4fed1d --- /dev/null +++ b/android/app/src/main/res/drawable-v24/ic_launcher_background.xml @@ -0,0 +1,21 @@ + + + + + + + + + + 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 e4502f69cd..3e85a65d25 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 bf3e6a5263..0000000000 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 4b1e11cb42..0000000000 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 67764cd132..0000000000 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 612d02be8d..0000000000 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 159d7d4a51..a13087a4ef 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 a95427d0a0..0000000000 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 5c1b8fb5e9..0000000000 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 fa8a8d2e86..0000000000 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 2622837a86..0000000000 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 c1bd0fe374..8adfb16743 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 df1c5467fe..0000000000 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 8a45bca890..0000000000 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 eaa2a3bcf0..0000000000 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 f9a4f02131..0000000000 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 0000000000..c4a603d4cc --- /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 0000000000..c4a603d4cc --- /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 427ab384bf..283cd03d73 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 0000000000..22ba3f90ce 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 0000000000..b5e4065313 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 874d548a63..7058008e3a 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 0000000000..63495400d8 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 0000000000..3296da8bcc 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 459fa34d00..27fe2a7e99 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 0000000000..707e833111 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 0000000000..6a05faa33c 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 91be92cc10..84884b9e31 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 0000000000..bc656a040e 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 0000000000..d1a0abb0e9 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 e0cfa5e340..4b60c7eb8d 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 0000000000..4eeb425392 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 0000000000..02cec6d94c 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 afec33cb3e..e8e7ca8c14 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 bf07a329d9..33e202a569 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 0000000000..5b6faa851c --- /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 7943fd9d0e..9527cac884 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 8d4e17e962..76a37b656e 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 0000000000..381958c54c --- /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 513ff5f345..5287367fb7 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 16e62f6d0e..93f53d846c 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 0a7ec86c8a..d6bc3731da 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 0000000000..2e679d968a --- /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 c951fd23f9..2e4aa5353f 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 e3f4f51476..e9a6b73b8b 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 f7fdbfdef2..f6278dd1aa 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 0000000000..fda0397650 --- /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 e13ca4398b..7cb5375f1b 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 dcdaa65851..6b7498dd8e 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 d3c5bb2888..e6e685b34d 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 { withTheme } from '../theme'; +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 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 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 - }, - 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 + ...sharedStyles.textSemibold }, - 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 ( - - - - - - - + <> +