From 31ead3c09c586251124b6f168a46d925a6e5e334 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Mon, 30 May 2022 19:02:08 -0300 Subject: [PATCH] Merge 4.28.0 into master (#4257) --- .circleci/config.yml | 36 ++- .github/dependabot.yml | 7 + android/app/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- app/actions/createDiscussion.ts | 10 +- app/actions/customEmojis.ts | 2 +- app/containers/ActionSheet/ActionSheet.tsx | 138 +++----- .../ActionSheet/BottomSheetContent.tsx | 59 ++++ app/containers/ActionSheet/Item.tsx | 12 +- app/containers/ActionSheet/Provider.tsx | 19 +- app/containers/ActionSheet/styles.ts | 3 +- app/containers/Button/Button.stories.js | 28 ++ app/containers/Button/Button.test.tsx | 71 +++++ .../__snapshots__/Button.stories.storyshot | 11 + app/containers/Button/index.tsx | 113 ++++--- app/containers/Check.tsx | 2 +- app/containers/CustomIcon/index.tsx | 23 ++ app/containers/CustomIcon/mappedIcons.js | 202 ++++++++++++ .../CustomIcon}/selection.json | 0 app/containers/DirectoryItem/index.tsx | 4 +- app/containers/EmojiPicker/CustomEmoji.tsx | 1 - app/containers/EmojiPicker/EmojiCategory.tsx | 10 +- app/containers/EmojiPicker/TabBar.tsx | 24 +- app/{ => containers/EmojiPicker}/emojis.ts | 2 +- app/containers/EmojiPicker/index.tsx | 58 ++-- .../HeaderButton/HeaderButtonItem.tsx | 4 +- .../InAppNotification/NotifierComponent.tsx | 4 +- app/containers/List/ListIcon.tsx | 4 +- app/containers/List/ListItem.tsx | 4 +- app/containers/Loading.tsx | 167 +++------- app/containers/LoginServices.tsx | 9 +- app/containers/MessageActions/Header.tsx | 8 +- app/containers/MessageActions/index.tsx | 35 +- .../MessageBox/CommandsPreview/Item.tsx | 2 +- app/containers/MessageBox/EmojiKeyboard.tsx | 5 +- .../MessageBox/Mentions/MentionHeaderList.tsx | 2 +- app/containers/MessageBox/RecordAudio.tsx | 2 +- app/containers/MessageBox/ReplyPreview.tsx | 2 +- .../MessageBox/buttons/BaseButton.tsx | 8 +- app/containers/MessageBox/index.tsx | 48 +-- app/containers/MessageErrorActions.tsx | 13 +- app/containers/Passcode/Base/Button.tsx | 4 +- app/containers/Passcode/Base/LockIcon.tsx | 2 +- app/containers/ReactionsModal.tsx | 4 +- .../RoomHeader.stories.storyshot | 12 +- app/containers/RoomItem/Actions.tsx | 2 +- .../RoomTypeIcon/OmnichannelRoomIcon.tsx | 16 +- app/containers/RoomTypeIcon/index.tsx | 6 +- app/containers/SearchBox.tsx | 4 +- app/containers/SearchHeader.tsx | 2 +- app/containers/Status/Status.tsx | 6 +- app/containers/Status/index.tsx | 6 +- .../FormTextInput.tsx} | 37 +-- .../{ => TextInput}/TextInput.stories.js | 6 +- .../__snapshots__/TextInput.stories.storyshot | 0 .../TextInput/index.tsx} | 6 +- app/containers/ThreadDetails.tsx | 2 +- app/containers/TwoFactor/index.tsx | 18 +- app/containers/UIKit/Actions.tsx | 8 +- app/containers/UIKit/Context.tsx | 4 +- app/containers/UIKit/DatePicker.tsx | 10 +- app/containers/UIKit/Image.tsx | 6 +- app/containers/UIKit/Input.tsx | 4 +- app/containers/UIKit/MultiSelect/Chips.tsx | 2 +- app/containers/UIKit/MultiSelect/Input.tsx | 2 +- app/containers/UIKit/MultiSelect/index.tsx | 12 +- app/containers/UIKit/Overflow.tsx | 2 +- app/containers/UIKit/Section.tsx | 4 +- app/containers/UIKit/Select.tsx | 2 +- app/containers/UIKit/index.tsx | 54 +++- app/containers/UIKit/interfaces.ts | 10 +- app/containers/UIKit/utils.ts | 6 +- app/containers/UserItem.tsx | 6 +- app/containers/markdown/Table.tsx | 15 +- app/containers/markdown/index.tsx | 29 +- app/containers/markdown/styles.ts | 4 - app/containers/message/Attachments.tsx | 2 +- app/containers/message/Audio.tsx | 2 +- app/containers/message/Broadcast.tsx | 2 +- app/containers/message/CallButton.tsx | 2 +- .../Components/CollapsibleQuote/index.tsx | 2 +- .../message/Components/RightIcons/Edited.tsx | 23 ++ .../Components/RightIcons/Encrypted.tsx | 26 ++ .../RightIcons}/MessageError.tsx | 18 +- .../RightIcons}/ReadReceipt.tsx | 10 +- .../message/Components/RightIcons/index.tsx | 34 ++ app/containers/message/Content.tsx | 14 +- app/containers/message/Discussion.tsx | 2 +- app/containers/message/Encrypted.tsx | 26 -- app/containers/message/Message.tsx | 13 +- app/containers/message/Reactions.tsx | 2 +- app/containers/message/RepliedThread.tsx | 2 +- app/containers/message/Reply.tsx | 12 +- app/containers/message/User.tsx | 30 +- app/containers/message/Video.tsx | 2 +- app/containers/message/index.tsx | 13 +- app/containers/message/interfaces.ts | 10 +- app/containers/message/styles.ts | 13 +- app/containers/message/utils.ts | 63 +++- app/definitions/IAssetsFavicon512.ts | 4 + app/definitions/IAttachment.ts | 11 + app/definitions/ICannedResponse.ts | 20 -- app/definitions/ICredentials.ts | 3 + app/definitions/ICustomEmoji.ts | 11 - app/definitions/IDataSelect.ts | 4 + app/definitions/IEmoji.ts | 44 ++- app/definitions/IFrequentlyUsedEmoji.ts | 11 - app/definitions/ILivechatDepartment.ts | 5 + app/definitions/ILivechatVisitor.ts | 2 +- app/definitions/IMessage.ts | 13 +- app/definitions/IProfile.ts | 31 ++ app/definitions/IProfileViewInterfaces.ts | 69 ---- app/definitions/IRocketChat.ts | 19 -- app/definitions/IRoom.ts | 24 ++ app/definitions/ISearch.ts | 2 +- app/definitions/index.ts | 5 +- app/definitions/navigationTypes.ts | 10 +- app/definitions/rest/v1/autotranslate.ts | 5 + app/definitions/rest/v1/index.ts | 4 +- app/definitions/rest/v1/users.ts | 7 +- .../OmnichannelHeader/OmnichannelQueue.tsx | 2 +- .../containers/OmnichannelHeader/index.tsx | 4 +- .../omnichannel/lib/subscriptions/inquiry.ts | 7 +- app/ee/omnichannel/sagas/inquiry.js | 4 +- app/ee/omnichannel/views/QueueListView.tsx | 170 ++++------ app/externalModules.d.ts | 1 - app/i18n/locales/en.json | 9 + app/index.tsx | 46 +-- app/lib/Icons.js | 7 - app/lib/constants/keys.ts | 3 + app/lib/encryption/encryption.ts | 8 +- app/lib/encryption/room.ts | 10 +- app/lib/hooks/index.ts | 1 + app/lib/hooks/useAppSelector.ts | 5 + app/lib/methods/actions.ts | 6 +- app/lib/methods/canOpenRoom.ts | 6 +- app/lib/methods/clearCache.ts | 2 +- app/lib/methods/crashReport.ts | 19 ++ app/lib/methods/enterpriseModules.ts | 5 - app/lib/methods/getCustomEmojis.ts | 5 +- app/lib/methods/getPermalinks.ts | 2 +- app/lib/methods/getRoom.ts | 2 +- app/lib/methods/getRoomInfo.ts | 4 +- app/lib/methods/getRooms.ts | 2 +- app/lib/methods/getSettings.ts | 2 +- app/lib/methods/getSingleMessage.ts | 4 +- app/lib/methods/getSlashCommands.ts | 2 +- app/lib/methods/getUsersPresence.ts | 19 +- app/lib/methods/helpers.ts | 63 +--- app/lib/methods/helpers/showToast.ts | 4 + app/lib/methods/index.ts | 37 +++ app/lib/methods/loadMessagesForRoom.ts | 4 +- app/lib/methods/loadMissedMessages.ts | 2 +- app/lib/methods/loadNextMessages.ts | 2 +- app/lib/methods/loadSurroundingMessages.ts | 2 +- app/lib/methods/loadThreadMessages.ts | 2 +- app/lib/methods/logout.ts | 35 +- app/lib/methods/parseSettings.ts | 23 ++ app/lib/methods/readMessages.ts | 2 +- app/lib/methods/roomTypeToApiType.ts | 4 +- app/lib/methods/sendMessage.ts | 2 +- app/lib/methods/setUser.ts | 42 ++- .../{services => methods}/shareExtension.ts | 19 +- app/lib/methods/subscribeRooms.ts | 18 ++ app/lib/methods/subscriptions/room.ts | 7 +- app/lib/methods/subscriptions/rooms.ts | 20 +- app/lib/methods/triggerActions.ts | 17 +- app/lib/methods/useServer.ts | 29 ++ app/lib/notifications/index.ts | 8 +- app/lib/notifications/push.ts | 120 +++---- app/lib/rocketchat.ts | 77 ----- app/lib/services/connect.ts | 100 +++--- app/lib/services/index.ts | 7 + app/lib/services/restApi.ts | 24 +- app/reducers/createChannel.ts | 2 +- app/reducers/customEmojis.test.ts | 3 +- app/reducers/customEmojis.ts | 12 +- app/reducers/settings.ts | 3 +- app/sagas/createChannel.js | 20 +- app/sagas/createDiscussion.js | 8 +- app/sagas/deepLinking.js | 20 +- app/sagas/encryption.js | 6 +- app/sagas/init.js | 12 +- app/sagas/inviteLinks.js | 11 +- app/sagas/login.js | 91 +++--- app/sagas/messages.js | 4 +- app/sagas/room.js | 18 +- app/sagas/rooms.js | 6 +- app/sagas/selectServer.js | 39 +-- app/sagas/state.js | 12 +- app/share.tsx | 18 +- app/stacks/InsideStack.tsx | 17 +- app/stacks/MasterDetailStack/index.tsx | 24 +- app/stacks/MasterDetailStack/types.ts | 8 +- app/stacks/OutsideStack.tsx | 2 +- app/stacks/types.ts | 22 +- app/theme.tsx | 2 +- app/utils/fetch.ts | 15 +- app/utils/goRoom.ts | 9 +- app/utils/isReadOnly.ts | 4 +- app/utils/localAuthentication.ts | 34 +- app/utils/log/events.ts | 6 +- app/utils/media.ts | 21 +- app/utils/sslPinning.ts | 3 +- app/views/AddChannelTeamView.tsx | 33 +- app/views/AddExistingChannelView.tsx | 15 +- app/views/AdminPanelView/index.tsx | 72 ++--- app/views/AttachmentView.tsx | 10 +- app/views/AuthLoadingView.tsx | 40 +-- app/views/AuthenticationWebView.tsx | 17 +- app/views/AutoTranslateView/index.tsx | 29 +- app/views/CannedResponseDetail.tsx | 23 +- .../CannedResponseItem.tsx | 1 - .../Dropdown/DropdownItem.tsx | 4 +- .../Dropdown/DropdownItemFilter.tsx | 8 +- .../Dropdown/DropdownItemHeader.tsx | 6 +- .../Dropdown/index.tsx | 8 +- .../CannedResponseItem.stories.storyshot | 2 +- app/views/CannedResponsesListView/index.tsx | 30 +- app/views/ChangePasscodeView.tsx | 2 +- app/views/CreateChannelView.tsx | 8 +- .../CreateDiscussionView/SelectChannel.tsx | 12 +- .../CreateDiscussionView/SelectUsers.tsx | 23 +- app/views/CreateDiscussionView/index.tsx | 38 +-- app/views/CreateDiscussionView/interfaces.ts | 18 +- app/views/DefaultBrowserView.tsx | 23 +- app/views/DirectoryView/Options.tsx | 9 +- app/views/DirectoryView/index.tsx | 75 +++-- .../DiscussionsView/DiscussionDetails.tsx | 15 +- app/views/DiscussionsView/Item.stories.js | 4 +- app/views/DiscussionsView/Item.tsx | 12 +- app/views/DiscussionsView/index.tsx | 21 +- app/views/DisplayPrefsView.tsx | 43 +-- app/views/E2EEncryptionSecurityView.tsx | 50 ++- app/views/E2EEnterYourPasswordView.tsx | 5 +- app/views/E2EHowItWorksView.tsx | 18 +- app/views/E2ESaveYourPasswordView.tsx | 13 +- app/views/ForgotPasswordView.tsx | 30 +- app/views/ForwardLivechatView.tsx | 20 +- app/views/InviteUsersEditView/index.tsx | 3 +- app/views/InviteUsersView/index.tsx | 115 +++---- app/views/JitsiMeetView.tsx | 17 +- app/views/LanguageView/index.tsx | 4 +- app/views/LegalView.tsx | 86 +++-- app/views/LivechatEditView.tsx | 50 +-- app/views/LoginView.tsx | 21 +- app/views/MarkdownTableView.tsx | 53 ++- app/views/MessagesView/index.tsx | 107 ++++--- app/views/ModalBlockView.tsx | 17 +- app/views/NewMessageView.tsx | 46 +-- app/views/NewServerView/ServerInput/Item.tsx | 2 +- app/views/NewServerView/ServerInput/index.tsx | 4 +- app/views/NewServerView/index.tsx | 22 +- .../NotificationPreferencesView/index.tsx | 25 +- app/views/PickerView.tsx | 9 +- app/views/ProfileView/index.tsx | 152 +++++---- app/views/ReadReceiptView/index.tsx | 10 +- app/views/RegisterView.tsx | 41 ++- app/views/RoomActionsView/index.tsx | 133 ++++---- app/views/RoomInfoEditView/index.tsx | 93 +++--- app/views/RoomInfoView/CustomFields.tsx | 2 +- app/views/RoomInfoView/Direct.tsx | 5 +- app/views/RoomInfoView/Livechat.tsx | 4 +- app/views/RoomInfoView/index.tsx | 55 ++-- app/views/RoomMembersView/index.tsx | 66 ++-- app/views/RoomView/Banner.tsx | 2 +- app/views/RoomView/JoinCode.tsx | 23 +- app/views/RoomView/List/List.tsx | 4 +- app/views/RoomView/List/NavBottomFAB.tsx | 2 +- app/views/RoomView/List/index.tsx | 27 +- .../__snapshots__/LoadMore.stories.storyshot | 6 +- app/views/RoomView/ReactionPicker.tsx | 10 +- app/views/RoomView/RightButtons.tsx | 6 +- app/views/RoomView/Separator.tsx | 6 +- app/views/RoomView/UploadProgress.tsx | 14 +- app/views/RoomView/index.tsx | 166 +++++----- app/views/RoomView/services/getMessages.ts | 4 +- .../RoomView/services/getMoreMessages.ts | 4 +- .../RoomView/services/getThreadMessages.ts | 6 - app/views/RoomView/services/index.ts | 4 - app/views/RoomView/services/readMessages.ts | 5 - app/views/RoomsListView/Header/Header.tsx | 4 +- app/views/RoomsListView/ServerDropdown.tsx | 9 +- app/views/RoomsListView/index.tsx | 141 ++++---- app/views/ScreenLockConfigView.tsx | 8 +- app/views/ScreenLockedView.tsx | 40 ++- app/views/SearchMessagesView/index.tsx | 72 +++-- app/views/SecurityPrivacyView.tsx | 45 ++- app/views/SelectListView.tsx | 36 ++- app/views/SelectServerView.tsx | 25 +- app/views/SelectedUsersView.tsx | 32 +- app/views/SendEmailConfirmationView.tsx | 20 +- app/views/SetUsernameView.tsx | 16 +- app/views/SettingsView/index.tsx | 22 +- app/views/ShareListView/Header/Header.tsx | 2 +- app/views/ShareListView/index.tsx | 43 +-- app/views/ShareView/Header.tsx | 14 +- app/views/ShareView/Preview.tsx | 10 +- app/views/ShareView/Thumbs.tsx | 12 +- app/views/ShareView/index.tsx | 49 +-- app/views/ShareView/interfaces.ts | 15 - app/views/SidebarView/index.tsx | 78 ++--- app/views/StatusView.tsx | 213 ------------- app/views/StatusView/index.tsx | 193 +++++++++++ app/views/TeamChannelsView.tsx | 124 +++----- app/views/ThemeView.tsx | 95 +++--- .../Dropdown/DropdownItem.tsx | 29 +- .../ThreadMessagesView/Dropdown/index.tsx | 10 +- app/views/ThreadMessagesView/Item.tsx | 4 +- app/views/ThreadMessagesView/index.tsx | 63 ++-- .../UserNotificationPreferencesView/index.tsx | 10 +- app/views/UserPreferencesView/index.tsx | 12 +- app/views/WorkspaceView/index.tsx | 24 +- babel.config.js | 6 +- docs/icons.md | 15 + e2e/helpers/app.js | 10 +- e2e/tests/onboarding/04-createuser.spec.js | 1 + e2e/tests/onboarding/05-login.spec.js | 4 +- e2e/tests/onboarding/06-roomslist.spec.js | 2 +- e2e/tests/room/01-createroom.spec.js | 3 + e2e/tests/room/02-room.spec.js | 10 +- e2e/tests/room/09-jumptomessage.spec.js | 4 +- e2e/tests/team/02-team.spec.js | 4 +- ios/Podfile.lock | 14 +- ios/RocketChatRN.xcodeproj/project.pbxproj | 4 +- ios/RocketChatRN/Info.plist | 2 +- ios/ShareRocketChatRN/Info.plist | 2 +- package.json | 29 +- patches/commonmark+0.29.0.patch | 13 + .../react-native-notifications+4.2.4.patch | 36 --- ...act-native-scroll-bottom-sheet+0.6.2.patch | 42 --- scripts/build-icon-set.js | 20 ++ storybook/stories/Markdown.tsx | 10 +- storybook/stories/Message.js | 57 +++- .../stories/__snapshots__/List.storyshot | 2 +- .../stories/__snapshots__/Markdown.storyshot | 2 - .../stories/__snapshots__/Message.storyshot | 74 ++--- .../stories/__snapshots__/RoomItem.storyshot | 6 +- storybook/stories/index.js | 6 +- yarn.lock | 301 ++++++++++++------ 340 files changed, 4150 insertions(+), 3742 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 app/containers/ActionSheet/BottomSheetContent.tsx create mode 100644 app/containers/Button/Button.stories.js create mode 100644 app/containers/Button/Button.test.tsx create mode 100644 app/containers/Button/__snapshots__/Button.stories.storyshot create mode 100644 app/containers/CustomIcon/index.tsx create mode 100644 app/containers/CustomIcon/mappedIcons.js rename app/{lib => containers/CustomIcon}/selection.json (100%) rename app/{ => containers/EmojiPicker}/emojis.ts (99%) rename app/containers/{TextInput.tsx => TextInput/FormTextInput.tsx} (82%) rename app/containers/{ => TextInput}/TextInput.stories.js (72%) rename app/containers/{ => TextInput}/__snapshots__/TextInput.stories.storyshot (100%) rename app/{presentation/TextInput.tsx => containers/TextInput/index.tsx} (83%) create mode 100644 app/containers/message/Components/RightIcons/Edited.tsx create mode 100644 app/containers/message/Components/RightIcons/Encrypted.tsx rename app/containers/message/{ => Components/RightIcons}/MessageError.tsx (54%) rename app/containers/message/{ => Components/RightIcons}/ReadReceipt.tsx (64%) create mode 100644 app/containers/message/Components/RightIcons/index.tsx delete mode 100644 app/containers/message/Encrypted.tsx create mode 100644 app/definitions/IAssetsFavicon512.ts delete mode 100644 app/definitions/ICustomEmoji.ts create mode 100644 app/definitions/IDataSelect.ts delete mode 100644 app/definitions/IFrequentlyUsedEmoji.ts create mode 100644 app/definitions/IProfile.ts delete mode 100644 app/definitions/IProfileViewInterfaces.ts delete mode 100644 app/definitions/IRocketChat.ts create mode 100644 app/definitions/rest/v1/autotranslate.ts delete mode 100644 app/lib/Icons.js create mode 100644 app/lib/hooks/index.ts create mode 100644 app/lib/hooks/useAppSelector.ts create mode 100644 app/lib/methods/crashReport.ts create mode 100644 app/lib/methods/helpers/showToast.ts create mode 100644 app/lib/methods/index.ts create mode 100644 app/lib/methods/parseSettings.ts rename app/lib/{services => methods}/shareExtension.ts (80%) create mode 100644 app/lib/methods/subscribeRooms.ts create mode 100644 app/lib/methods/useServer.ts delete mode 100644 app/lib/rocketchat.ts create mode 100644 app/lib/services/index.ts delete mode 100644 app/views/RoomView/services/getThreadMessages.ts delete mode 100644 app/views/RoomView/services/readMessages.ts delete mode 100644 app/views/ShareView/interfaces.ts delete mode 100644 app/views/StatusView.tsx create mode 100644 app/views/StatusView/index.tsx create mode 100644 docs/icons.md create mode 100644 patches/commonmark+0.29.0.patch delete mode 100644 patches/react-native-scroll-bottom-sheet+0.6.2.patch create mode 100644 scripts/build-icon-set.js diff --git a/.circleci/config.yml b/.circleci/config.yml index edf2dcb14..1be1e3871 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,7 +150,7 @@ commands: if [[ $CIRCLE_JOB == "android-build-official" ]]; then ./gradlew bundleOfficialPlayRelease fi - if [[ $CIRCLE_JOB == "android-build-experimental" ]]; then + if [[ $CIRCLE_JOB == "android-build-experimental" || "android-automatic-build-experimental" ]]; then ./gradlew bundleExperimentalPlayRelease fi if [[ ! $KEYSTORE ]]; then @@ -169,7 +169,7 @@ commands: --source-map=android/app/build/generated/sourcemaps/react/officialPlay/release/app.bundle.map \ --bundle android/app/build/generated/assets/react/officialPlay/release/app.bundle fi - if [[ $CIRCLE_JOB == "android-build-experimental" ]]; then + if [[ $CIRCLE_JOB == "android-build-experimental" || "android-automatic-build-experimental" ]]; then npx bugsnag-source-maps upload-react-native \ --api-key=$BUGSNAG_KEY \ --app-version-code=$CIRCLE_BUILD_NUM \ @@ -379,7 +379,19 @@ jobs: resource_class: large steps: - android-build - + + # Android automatic builds + android-automatic-build-experimental: + <<: *defaults + docker: + - image: circleci/android:api-29-node + environment: + <<: *android-env + <<: *bash-env + resource_class: large + steps: + - android-build + android-build-official: <<: *defaults docker: @@ -485,6 +497,10 @@ workflows: type: approval requires: - lint-testunit + filters: + branches: + ignore: + - develop - android-build-experimental: requires: - android-hold-build-experimental @@ -505,7 +521,7 @@ workflows: - android-google-play-production-experimental: requires: - android-hold-google-play-production-experimental - + # Android Official - android-hold-build-official: type: approval @@ -521,3 +537,15 @@ workflows: - android-google-play-beta-official: requires: - android-hold-google-play-beta-official + + # Android Automatic Experimental + - android-automatic-build-experimental: + filters: + branches: + only: + - develop + requires: + - lint-testunit + - android-google-play-production-experimental: + requires: + - android-automatic-build-experimental diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..880b92a78 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 25 \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 2f8a6ef6c..a44f99069 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -144,7 +144,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode VERSIONCODE as Integer - versionName "4.27.1" + versionName "4.28.0" vectorDrawables.useSupportLibrary = true if (!isFoss) { manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String] diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 312cce983..40d363a85 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists \ No newline at end of file diff --git a/app/actions/createDiscussion.ts b/app/actions/createDiscussion.ts index bf64baaa6..d9d9690a5 100644 --- a/app/actions/createDiscussion.ts +++ b/app/actions/createDiscussion.ts @@ -2,8 +2,16 @@ import { Action } from 'redux'; import { CREATE_DISCUSSION } from './actionsTypes'; +export interface ICreateDiscussionRequestData { + prid: string; + pmid?: string; + t_name?: string; + reply?: string; + users: string[]; + encrypted?: boolean; +} interface ICreateDiscussionRequest extends Action { - data: any; + data: ICreateDiscussionRequestData; } interface ICreateDiscussionSuccess extends Action { diff --git a/app/actions/customEmojis.ts b/app/actions/customEmojis.ts index 261fbd241..a870d21fb 100644 --- a/app/actions/customEmojis.ts +++ b/app/actions/customEmojis.ts @@ -1,7 +1,7 @@ import { Action } from 'redux'; -import { ICustomEmojis } from '../reducers/customEmojis'; import { SET_CUSTOM_EMOJIS } from './actionsTypes'; +import { ICustomEmojis } from '../definitions'; export interface ISetCustomEmojis extends Action { emojis: ICustomEmojis; diff --git a/app/containers/ActionSheet/ActionSheet.tsx b/app/containers/ActionSheet/ActionSheet.tsx index 673e515a1..c028bada6 100644 --- a/app/containers/ActionSheet/ActionSheet.tsx +++ b/app/containers/ActionSheet/ActionSheet.tsx @@ -1,32 +1,21 @@ import { useBackHandler } from '@react-native-community/hooks'; import * as Haptics from 'expo-haptics'; -import React, { forwardRef, isValidElement, useEffect, useImperativeHandle, useRef, useState } from 'react'; -import { Keyboard, Text } from 'react-native'; -import { HandlerStateChangeEventPayload, State, TapGestureHandler } from 'react-native-gesture-handler'; -import Animated, { Easing, Extrapolate, interpolateNode, Value } from 'react-native-reanimated'; +import React, { forwardRef, isValidElement, useEffect, useImperativeHandle, useRef, useState, useCallback } from 'react'; +import { Keyboard } from 'react-native'; +import { Easing } from 'react-native-reanimated'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; -import ScrollBottomSheet from 'react-native-scroll-bottom-sheet'; +import BottomSheet, { BottomSheetBackdrop } from '@gorhom/bottom-sheet'; -import { themes } from '../../lib/constants'; import { useDimensions, useOrientation } from '../../dimensions'; -import I18n from '../../i18n'; import { useTheme } from '../../theme'; import { isIOS, isTablet } from '../../utils/deviceInfo'; -import * as List from '../List'; -import { Button } from './Button'; import { Handle } from './Handle'; -import { IActionSheetItem, Item } from './Item'; -import { TActionSheetOptions, TActionSheetOptionsItem } from './Provider'; +import { TActionSheetOptions } from './Provider'; +import BottomSheetContent from './BottomSheetContent'; import styles, { ITEM_HEIGHT } from './styles'; -const getItemLayout = (data: TActionSheetOptionsItem[] | null | undefined, index: number) => ({ - length: ITEM_HEIGHT, - offset: ITEM_HEIGHT * index, - index -}); - const HANDLE_HEIGHT = isIOS ? 40 : 56; -const MAX_SNAP_HEIGHT = 16; +const MIN_SNAP_HEIGHT = 16; const CANCEL_HEIGHT = 64; const ANIMATION_DURATION = 250; @@ -39,27 +28,26 @@ const ANIMATION_CONFIG = { const ActionSheet = React.memo( forwardRef(({ children }: { children: React.ReactElement }, ref) => { - const { theme } = useTheme(); - const bottomSheetRef = useRef>(null); + const { colors } = useTheme(); + const bottomSheetRef = useRef(null); const [data, setData] = useState({} as TActionSheetOptions); const [isVisible, setVisible] = useState(false); const { height } = useDimensions(); const { isLandscape } = useOrientation(); const insets = useSafeAreaInsets(); - const maxSnap = Math.max( - height - - // Items height - ITEM_HEIGHT * (data?.options?.length || 0) - + const maxSnap = Math.min( + // Items height + ITEM_HEIGHT * (data?.options?.length || 0) + // Handle height - HANDLE_HEIGHT - + HANDLE_HEIGHT + // Custom header height - (data?.headerHeight || 0) - + (data?.headerHeight || 0) + // Insets bottom height (Notch devices) - insets.bottom - + insets.bottom + // Cancel button height (data?.hasCancel ? CANCEL_HEIGHT : 0), - MAX_SNAP_HEIGHT + height - MIN_SNAP_HEIGHT ); /* @@ -69,14 +57,12 @@ const ActionSheet = React.memo( * we'll provide more one snap * that point 50% of the whole screen */ - const snaps = height - maxSnap > height * 0.6 && !isLandscape ? [maxSnap, height * 0.5, height] : [maxSnap, height]; - const openedSnapIndex = snaps.length > 2 ? 1 : 0; - const closedSnapIndex = snaps.length - 1; + const snaps = maxSnap > height * 0.6 && !isLandscape && !data.snaps ? [height * 0.5, maxSnap] : [maxSnap]; const toggleVisible = () => setVisible(!isVisible); const hide = () => { - bottomSheetRef.current?.snapTo(closedSnapIndex); + bottomSheetRef.current?.close(); }; const show = (options: TActionSheetOptions) => { @@ -84,12 +70,6 @@ const ActionSheet = React.memo( toggleVisible(); }; - const onBackdropPressed = ({ nativeEvent }: { nativeEvent: HandlerStateChangeEventPayload }) => { - if (nativeEvent.oldState === State.ACTIVE) { - hide(); - } - }; - useBackHandler(() => { if (isVisible) { hide(); @@ -101,7 +81,6 @@ const ActionSheet = React.memo( if (isVisible) { Keyboard.dismiss(); Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light); - bottomSheetRef.current?.snapTo(openedSnapIndex); } }, [isVisible]); @@ -122,26 +101,18 @@ const ActionSheet = React.memo( ); - const renderFooter = () => - data?.hasCancel ? ( - - ) : null; - - const renderItem = ({ item }: { item: IActionSheetItem['item'] }) => ; - - const animatedPosition = React.useRef(new Value(0)); - const opacity = interpolateNode(animatedPosition.current, { - inputRange: [0, 1], - outputRange: [0, themes[theme].backdropOpacity], - extrapolate: Extrapolate.CLAMP - }) as any; // The function's return differs from the expected type of opacity, however this problem is something related to lib, maybe when updating the types will be fixed. + const renderBackdrop = useCallback( + props => ( + + ), + [] + ); const bottomSheet = isLandscape || isTablet ? styles.bottomSheet : {}; @@ -149,42 +120,19 @@ const ActionSheet = React.memo( <> {children} {isVisible && ( - <> - - - - - testID='action-sheet' - ref={bottomSheetRef} - componentType='FlatList' - snapPoints={snaps} - initialSnapIndex={closedSnapIndex} - renderHandle={renderHandle} - onSettle={index => index === closedSnapIndex && toggleVisible()} - animatedPosition={animatedPosition.current} - containerStyle={{ ...styles.container, ...bottomSheet, backgroundColor: themes[theme].focusedBackground }} - animationConfig={ANIMATION_CONFIG} - data={data.options} - renderItem={renderItem} - keyExtractor={item => item.title} - style={{ backgroundColor: themes[theme].focusedBackground }} - contentContainerStyle={styles.content} - ItemSeparatorComponent={List.Separator} - ListHeaderComponent={List.Separator} - ListFooterComponent={renderFooter} - getItemLayout={getItemLayout} - removeClippedSubviews={isIOS} - /> - + index === -1 && toggleVisible()}> + + )} ); diff --git a/app/containers/ActionSheet/BottomSheetContent.tsx b/app/containers/ActionSheet/BottomSheetContent.tsx new file mode 100644 index 000000000..ea3b1f1f8 --- /dev/null +++ b/app/containers/ActionSheet/BottomSheetContent.tsx @@ -0,0 +1,59 @@ +import { Text } from 'react-native'; +import React from 'react'; +import { BottomSheetView, BottomSheetFlatList } from '@gorhom/bottom-sheet'; + +import { Button } from './Button'; +import I18n from '../../i18n'; +import { useTheme } from '../../theme'; +import { IActionSheetItem, Item } from './Item'; +import { TActionSheetOptionsItem } from './Provider'; +import styles from './styles'; +import * as List from '../List'; + +interface IBottomSheetContentProps { + hasCancel?: boolean; + options?: TActionSheetOptionsItem[]; + hide: () => void; + children?: React.ReactElement | null; +} + +const BottomSheetContent = React.memo(({ options, hasCancel, hide, children }: IBottomSheetContentProps) => { + const { theme, colors } = useTheme(); + + const renderFooter = () => + hasCancel ? ( + + ) : null; + + const renderItem = ({ item }: { item: IActionSheetItem['item'] }) => ; + + if (options) { + return ( + item.title} + bounces={true} + renderItem={renderItem} + style={{ backgroundColor: colors.focusedBackground }} + keyboardDismissMode='interactive' + indicatorStyle='black' + contentContainerStyle={styles.content} + ItemSeparatorComponent={List.Separator} + ListHeaderComponent={List.Separator} + ListFooterComponent={renderFooter} + /> + ); + } + return {children}; +}); + +export default BottomSheetContent; diff --git a/app/containers/ActionSheet/Item.tsx b/app/containers/ActionSheet/Item.tsx index 1a1627006..2b0b50080 100644 --- a/app/containers/ActionSheet/Item.tsx +++ b/app/containers/ActionSheet/Item.tsx @@ -2,20 +2,14 @@ import React from 'react'; import { Text, View } from 'react-native'; import { themes } from '../../lib/constants'; -import { CustomIcon } from '../../lib/Icons'; +import { CustomIcon } from '../CustomIcon'; import { useTheme } from '../../theme'; import { Button } from './Button'; +import { TActionSheetOptionsItem } from './Provider'; import styles from './styles'; export interface IActionSheetItem { - item: { - title: string; - icon: string; - danger?: boolean; - testID?: string; - onPress: () => void; - right?: Function; - }; + item: TActionSheetOptionsItem; hide(): void; } diff --git a/app/containers/ActionSheet/Provider.tsx b/app/containers/ActionSheet/Provider.tsx index 8ad0e7c27..43f444702 100644 --- a/app/containers/ActionSheet/Provider.tsx +++ b/app/containers/ActionSheet/Provider.tsx @@ -1,14 +1,25 @@ import React, { ForwardedRef, forwardRef, useContext, useRef } from 'react'; import ActionSheet from './ActionSheet'; +import { TIconsName } from '../CustomIcon'; -export type TActionSheetOptionsItem = { title: string; icon: string; onPress: () => void; danger?: boolean }; +export type TActionSheetOptionsItem = { + title: string; + icon: TIconsName; + danger?: boolean; + testID?: string; + onPress: () => void; + right?: () => React.ReactElement; +}; export type TActionSheetOptions = { - options: TActionSheetOptionsItem[]; - headerHeight: number; - customHeader: React.ReactElement | null; + options?: TActionSheetOptionsItem[]; + headerHeight?: number; + customHeader?: React.ReactElement | null; hasCancel?: boolean; + type?: string; + children?: React.ReactElement | null; + snaps?: string[] | number[]; }; interface IActionSheetProvider { showActionSheet: (item: TActionSheetOptions) => void; diff --git a/app/containers/ActionSheet/styles.ts b/app/containers/ActionSheet/styles.ts index 1b9397dc9..68d371ea6 100644 --- a/app/containers/ActionSheet/styles.ts +++ b/app/containers/ActionSheet/styles.ts @@ -46,8 +46,7 @@ export default StyleSheet.create({ }, bottomSheet: { width: '50%', - alignSelf: 'center', - left: '25%' + marginHorizontal: '25%' }, button: { marginHorizontal: 16, diff --git a/app/containers/Button/Button.stories.js b/app/containers/Button/Button.stories.js new file mode 100644 index 000000000..165c8b49b --- /dev/null +++ b/app/containers/Button/Button.stories.js @@ -0,0 +1,28 @@ +import React from 'react'; +import { storiesOf } from '@storybook/react-native'; + +import Button from '.'; + +const buttonProps = { + title: 'Press me!', + type: 'primary', + onPress: () => {}, + testID: 'testButton', + fontSize: 16, + style: { + padding: 10, + justifyContent: 'center' + } +}; + +const stories = storiesOf('Button', module); + +stories.add('primary button', () =>