Merge beta into master (#2032)
* [FIX] Remove setState from notifications view causing watermelon object to be updated outside an action (#1342) * [IMPROVEMENT] Save last message as message when subscription is updated (#1344) * [UPDATE DEPS] Update RN to 0.61.3 (#1345) * [DOCS] Update Readme (#1346) * [CHORE] Remove react-native-scrollable-tab-view fork (#1352) * [FIX] URL preview (#1360) * [REGRESSION] Decrease list view memory size (#1361) * [FIX] Paste (#1350) * [CHORE] Update gems (#1365) * Bump version to 1.20.3 (#1366) * [FIX] Use Ruby 2.4 on TestFlight upload (#1368) * [FIX] Parse Urls (#1371) * [FIX] Parse image URL only if it's not empty (#1372) * [FIX] Load messages issues (#1373) * Bump version to 1.21.0 (#1376) * [FIX] Crowd login (#1381) * [FIX] Clicking user avatar in thread previews crashes app (#1363) * [IMPROVEMENT] Error messages on connect (#1379) * [FIX] ProfileView input navigation error when custom fields aren't set (#1383) * [FIX] Batch server deletion on logout (#1382) * Bump app to 1.22.0 (#1387) * [FIX] Server Version (#1392) * Update patch and minor deps (#1386) * [FIX] Crash when open thread (#1395) * Bump version to 1.23.0 (#1394) * [I18N] Update ru.js (#1384) * [FIX] CAS building wrong URL (#1362) * [FIX] Delete messages (#1399) * [FIX] In-app notification showing wrong content on channels (#1400) * Bump version to 1.24.0 (#1404) * [FIX] Prevent server with whitespace (#1402) * [IMPROVEMENT] Keyboard and content type on login (#1403) * [FIX] Messages stop loading (#1410) * [NEW] Tablet support (#1300) * [IMPROVEMENT] Authentication via deep linking (#1418) * [IMPROVEMENT] Markdown performance when identifying emoji only content (#1422) * [FIX] BackHandler remove random failing on development (#1423) * Bump version to 1.25.0 (#1424) * [CHORE] Update CI Xcode Image (#1430) * [FIX] Rooms grouping not working properly (#1435) * [FIX] Take a video (#1437) * [NEW] Themes (#1298) * [FIX] Share extension doesn't reconnect to previous selected server on Android (#1429) * [FIX] Init local settings on notification tap (#1438) * Bump version to 1.26.0 (#1450) * [FIX] Emoji parser not working on Hermes (#1445) * [NEW] Enable Hermes (#1446) * [FIX] Automatic theme repeating (#1457) * [CHORE] Sync Experimental and Official app versions (#1458) * [DOCS] Update readme (#1459) * [FIX] Messages being sent but showing as temp status (#1469) * [FIX] Missing messages after reconnect (#1470) * [FIX] Few fixes on themes (#1477) * [I18N] Missing German translations (#1465) * Missing German translation * adding a missing space behind colon * added a missing space after colon * and another attempt to finally fix this – got confused by all the branches * some smaller fixes for the translation * better wording * fixed another typo * [FIX] Crash while displaying the attached image with http on file name (#1401) * [IMPROVEMENT] Tap app and server version to copy to clipboard (#1425) * [NEW] Reply notification (#1448) * [FIX] Incorrect background color login on iPad (#1480) * [FIX] Prevent multiple tap on send (Share Extension) (#1481) * [NEW] Image Viewer (#1479) * [DOCS] Update Readme (#1485) * [FIX] Jitsi with Hermes Enabled (#1523) * [FIX] Draft messages not working with themed Messagebox (#1525) * [FIX] Go to direct message from members list (#1519) * [FIX] Make SAML wait for idp token instead of creating it on client (#1527) * [FIX] Server Test Push Notification (#1508) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [CHORE] Update to new server response (#1509) * [FIX] Insert messages with blank users (#1529) * Bump version to 4.2.1 (#1530) * [FIX] Error when normalizing empty messages (#1532) * [REGRESSION] CAS (#1570) * Bump version to 4.2.2 (#1571) * [FIX] Add username block condition to prevent error (#1585) * Bump version to 4.2.3 * Bump version to 4.2.4 * Bump version to 4.3.0 (#1630) * [FIX] Channels doesn't load (#1586) * [FIX] Channels doesn't load * [FIX] Update roomsUpdatedAt when subscriptions.length is 0 * [FIX] Remove unnecessary changes * [FIX] Improve the code Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Make SAML to work on Rocket.Chat < 2.3.0 (#1629) * [NEW] Invite links (#1534) * [FIX] Set the http-agent to the form that Rocket.Chat requires for logging (#1482) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] "Following thread" and "Unfollowed Thread" is hardcoded and not translated (#1625) * [FIX] Disable reset button if form didn't changed (#1569) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Header title of RoomInfoView (#1553) * [I18N] Gallery Permissions DE (#1542) * [FIX] Not allow to send messages to archived room (#1623) * [FIX] Profile fields automatically reset (#1502) * [FIX] Show attachment on ThreadMessagesView (#1493) * [NEW] Wordpress auth (#1633) * [CHORE] Add Start Packager script (#1639) * [CHORE] Update RN to 0.61.5 (#1638) * [CHORE] Update RN to 0.61.5 * [CHORE] Update react-native patch Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * Bump version to 4.3.1 (#1641) * [FIX] Change force logout rule (#1640) * Bump version to 4.4.0 (#1643) * [IMPROVEMENT] Use MessagingStyle on Android Notification (#1575) * [NEW] Request review (#1627) * [NEW] Pull to refresh RoomView (#1657) * [FIX] Unsubscribe from room (#1655) * [FIX] Server with subdirs (#1646) * [NEW] Clear cache (#1660) * [IMPROVEMENT] Memoize and batch subscriptions updates (#1642) * [FIX] Disallow empty sharing (#1664) * [REGRESSION] Use HTTPS links for sharing and markets protocol for review (#1663) * [FIX] In some cases, share extension doesn't load images (#1649) * [i18n] DE translations for new invite function and some minor fixes (#1631) * [FIX] Remove duplicate jetify step (#1628) minor: also remove 'cd' calls Co-authored-by: Diego Mello <diegolmello@gmail.com> * [REGRESSION] Read messages (#1666) * [i18n] German translations missing (#1670) * [FIX] Notifications crash on older Android Versions (#1672) * [i18n] Added Dutch translation (#1676) * [NEW] Omnichannel Beta (#1674) * [NEW] Confirm logout/clear cache (#1688) * [I18N] Add es-ES language (#1495) * [NEW] UiKit Beta (#1497) * [IMPROVEMENT] Use reselect (#1696) * [FIX] Notification in Android API level less than 24 (#1692) * [IMPROVEMENT] Send tmid on slash commands and media (#1698) * [FIX] Unhandled action on UIKit (#1703) * [NEW] Pull to refresh RoomsList (#1701) * [IMPROVEMENT] Reset app when language is changed (#1702) * [FIX] Small fixes on UIKit (#1709) * [FIX] Spotlight (#1719) * [CHORE] Update react-native-image-crop-picker (#1712) * [FIX] Messages Overlapping (Android) and MessageBox Scroll (iOS) (#1720) * [REGRESSION] Remove @ and # from mention (#1721) * [NEW] Direct message from user info (#1516) * [FIX] Delete slash commands (#1723) * [IMPROVEMENT] Hold URL to copy (#1684) * [FIX] Different sourcemaps generation for Hermes (#1724) * [FIX] Different sourcemaps generation for Hermes * Upload sourcemaps after build * [REVERT] Show emoji keyboard on Android (#1738) * [FIX] Stop logging react-native-image-crop-picker (#1745) * [FIX] Prevent toast ref error (#1744) * [FIX] Prevent reaction map error (#1743) * [FIX] Add missing calls to user info (#1741) * [FIX] Catch room unsubscribe error (#1739) * [i18n] Missing German keys (#1735) * [FIX] Missing i18n on MessagesView title (#1733) * [FIX] UIKit Modal: Weird behavior on Android Tablet (#1742) * [i18n] Missing key on German (#1747) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [i18n] Add Italian (#1736) * [CHORE] Memory leaks investigation (#1675) * [IMPROVEMENT] Alert verify email when enabled (#1725) * [NEW] Jitsi JWT added to URL (#1746) * [FIX] UIKit submit when connection lost (#1748) * Bump version to 4.5.0 (#1761) * [NEW] Default browser (#1752) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] HTTP Basic Auth (#1753) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Honor profile fields edit settings (#1687) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Room announcements (#1726) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Honor Register/Login settings (#1727) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Make links clickable on Room Info (#1730) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [NEW] Hide system messages (#1755) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Honor "Message_AudioRecorderEnabled" (#1764) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [i18n] Missing de keys (#1765) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Redirect user to SetUsernameView (#1728) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Join Room (#1769) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Accept all media types using * (#1770) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Use RealName when necessary (#1758) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Markdown Line Break (#1783) * [IMPROVEMENT] Remove useMarkdown (#1774) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Open browser rather than webview on Create Workspace (#1788) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Markdown perf (#1796) * [FIX] Stop video when modal is closed (#1787) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Hide reply notification action when there are missing data (#1771) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [i18n] Added Japanese translation (#1781) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Reset password error message (#1772) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Close tablet modal (#1773) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Setting not present (#1775) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Thread header (#1776) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Keyboard tracking loses input ref (#1784) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [NEW] Mark message as unread (#1785) Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * [IMPROVEMENT] Log server version (#1786) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Add loading message on long running tasks (#1798) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [CHORE] Switch Apple account on Fastlane (#1810) * [FIX] Watermelon throwing "Cannot update a record with pending updates" (#1754) * [FIX] Detox tests (#1790) * [CHORE] Use markdown preview on RoomView Header (#1807) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] LoginSignup blink services (#1809) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Request user presence on demand (#1813) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Remove all invited users when create a channel (#1814) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Pop from room which you have been removed (#1819) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Room Info styles (#1820) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [i18n] Add missing German keys (#1800) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Empty mentions for @all and @here when real name is enabled (#1822) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [TESTS] Markdown added to Storybook (#1812) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [REGRESSION] Room View header title (#1827) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Storybook snapshots (#1831) Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * [FIX] Mentions (#1829) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Thread message not found (#1830) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Separate delete and remove channel (#1832) * Rename to delete room * Separate delete and remove channel * handleRemoved -> handleRoomRemoved * [FIX] Navigate to RoomsList & Handle tablet case Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * [NEW] Filter system messages per room (#1815) Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] e2e tests (#1838) * [FIX] Consecutive clear cache calls freezing app (#1851) * Bump version to 4.5.1 (#1853) * [FIX][iOS] Ignore silent mode on audio player (#1862) * [IMPROVEMENT] Create App Group property on Info.plist (#1858) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Make username clickable on message (#1618) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Show proper error message on profile (#1768) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [IMPROVEMENT] Show toast when a message is starred/unstarred (#1616) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Incorrect size params to avatar endpoint (#1875) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Remove unrecognized emoji flags on android (#1887) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Remove react-native global installs (#1886) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Emojis transparent on android (#1881) Co-authored-by: Diego Mello <diegolmello@gmail.com> * Bump acorn from 5.7.3 to 5.7.4 (#1876) Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Diego Mello <diegolmello@gmail.com> * Bump version to 4.6.0 (#1911) * [FIX] Encode Image URI (#1909) * [FIX] Encode Image URI * [FIX] Check if Image is Valid Co-authored-by: Diego Mello <diegolmello@gmail.com> * [NEW] Adaptive Icons (#1904) * Remove unnecessary stuff from debug build * Adaptive icon for experimental app * [FIX] Stop showing message on leave channel (#1896) * [FIX] Leave room don't show 'was removed' message * [FIX] Remove duplicated code Co-authored-by: Diego Mello <diegolmello@gmail.com> * [i18n] Added missing German translations(#1900) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Linkedin OAuth login (#1913) * [CHORE] Fix typo in CreateChannel View (#1930) * [FIX] Respect protocol in HTTP Auth IPs (#1933) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Use new LinkedIn OAuth url (#1935) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [CHORE] Use storyboard on splash screen (#1939) * Update react-native-bootsplash * iOS * Fix android * [FIX] Check if avatar exists before create Icon (#1927) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Ignore self typing event (#1950) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Change default directory listing to Users (#1948) * fix: change default directory listing to Users * follow server settings * Fix state to props Co-authored-by: Diego Mello <diegolmello@gmail.com> * [NEW] Onboarding layout (#1954) * Onboarding texts * OnboardingView * FormContainer * Minor fixes * NewServerView * Remove code * Refactor * WorkspaceView * Stash * Login with email working * Login with * Join open * Revert "Login with" This reverts commit d05dc507d2e9a2db76d433b9b1f62192eba35dbd. * Fix create account styles * Register * Refactor * LoginServices component * Refactor * Multiple servers * Remove native images * Refactor styles * Fix testid * Fix add server on tablet * i18n * Fix close modal * Fix TOTP * [FIX] Registration disabled * [FIX] Login Services separator * Fix logos * Fix AppVersion name * I18n * Minor fixes * [FIX] Custom Fields Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * [NEW] Create discussions (#1942) * [WIP][NEW] Create Discussion * [FIX] Clear multiselect & Translations * [NEW] Create Discussion at MessageActions * [NEW] Disabled Multiselect * [FIX] Initial channel * [NEW] Create discussion on MessageBox Actions * [FIX] Crashing on edit name * [IMPROVEMENT] New message layout * [CHORE] Update README * [NEW] Avatars on MultiSelect * [FIX] Select Users * [FIX] Add redirect and Handle tablet * [IMPROVEMENT] Split CreateDiscussionView * [FIX] Create a discussion inner discussion * [FIX] Create a discussion * [I18N] Add pt-br * Change icons * [FIX] Nav to discussion & header title * Fix header Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Load messages (#1910) * Create updateLastOpen param on readMessages * Remove InteractionManager from load messages * [NEW] Custom Status (#1811) * [NEW] Custom Status * [FIX] Subscribe to changes * [FIX] Improve code using Banner component * [IMPROVEMENT] Toggle modal * [NEW] Edit custom status from Sidebar * [FIX] Modal when tablet * [FIX] Styles * [FIX] Switch to react-native-promp-android * [FIX] Custom Status UI * [TESTS] E2E Custom Status * Fix banner * Fix banner * Fix subtitle * status text * Fix topic header * Fix RoomActionsView topic * Fix header alignment on Android * [FIX] RoomInfo crashes when without statusText * [FIX] Use users.setStatus * [FIX] Remove customStatus of ProfileView * [FIX] Room View Thread Header Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] UI issues of Create Discussion View (#1965) * [NEW] Direct Message between multiple users (#1958) * [WIP] DM between multiple users * [WIP][NEW] Create new DM between multiple users * [IMPROVEMENT] Improve createChannel Sagas * [IMPROVEMENT] Selected Users view * [IMPROVEMENT] Room Actions of Group DM * [NEW] Create new DM between multiple users * [NEW] Group DM avatar * [FIX] Directory border * [IMPROVEMENT] Use isGroupChat * [CHORE] Remove legacy getRoomMemberId * [NEW] RoomTypeIcon * [FIX] No use legacy method on RoomInfoView * [FIX] Blink header when create new DM * [FIX] Only show create direct message option when allowed * [FIX] RoomInfoView * pt-BR * Few fixes * Create button name * Show create button only after a user is selected * Fix max users issues Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Add server and hide login (#1968) * Navigate to new server workspace from ServerDropdown if there's no token * Hide login button based on login services and Accounts_ShowFormLogin setting * [FIX] Lint Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * [FIX] MultiSelect Keyboard behavior (Android) (#1969) * fixed-modal-position * made-changes Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * [FIX] Bottom border style on DirectoryView (#1963) * [FIX] Border style * [FIX] Refactoring * [FIX] fix color of border * Undo Co-authored-by: Aroo <azhaubassar@gmail.com> Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Clear settings on server change (#1967) * [FIX] Deeplinking without RoomId (#1925) * [FIX] Deeplinking without rid * [FIX] Join channel * [FIX] Deep linking without rid * Update app/lib/methods/canOpenRoom.js Co-authored-by: Diego Mello <diegolmello@gmail.com> * [NEW] Two Factor authentication via email (#1961) * First api call working * [NEW] REST API Post wrapper 2FA * [NEW] Send 2FA on Email * [I18n] Add translations * [NEW] Translations & Cancel totp * [CHORE] Totp -> TwoFactor * [NEW] Two Factor by email * [NEW] Tablet Support * [FIX] Text colors * [NEW] Password 2fa * [FIX] Encrypt password on 2FA * [NEW] MethodCall2FA * [FIX] Password fallback * [FIX] Wrap all post/methodCall with 2fa * [FIX] Wrap missed function * few fixes * [FIX] Use new TOTP on Login * [improvement] 2fa methodCall Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> * [FIX] Correct message for manual approval user Registration (#1906) * [FIX] Correct message for manual approval from admin shown on Registeration * lint fix - added semicolon * Updated the translations * [FIX] Translations * i18n to match server Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Direct Message between multiple users REST (#1974) * [FIX] Investigate app losing connection issues (#1890) * [WIP] Reopen without timeOut & ping with 5 sec & Fix Unsubscribe * [FIX] Remove duplicated close * [FIX] Use no-dist lib * [FIX] Try minor fix * [FIX] Try reopen connection when app was put on foreground * [FIX] Remove timeout * [FIX] Build * [FIX] Patch * [FIX] Snapshot * [IMPROVEMENT] Decrease time to reopen * [FIX] Some fixes * [FIX] Update sdk version * [FIX] Subscribe Room Once * [CHORE] Update sdk * [FIX] Subscribe Room * [FIX] Try to resend missed subs * [FIX] Users never show status when start app without network * [FIX] Subscribe to room * [FIX] Multiple servers * [CHORE] Update SDK * [FIX] Don't duplicate streams on subscribeAll * [FIX] Server version when start the app offline * [FIX] Server version cached * [CHORE] Remove unnecessary code * [FIX] Offline server version * [FIX] Subscribe before connect * [FIX] Remove unncessary props * [FIX] Update sdk * [FIX] User status & Unsubscribe Typing * [FIX] Typing at incorrect room * [FIX] Multiple Servers * [CHORE] Update SDK * [REVERT] Undo some changes on SDK * [CHORE] Update sdk to prevent incorrect subscribes * [FIX] Prevent no reconnect * [FIX] Remove close on open * [FIX] Clear typing when disconnect/connect to SDK * [CHORE] Update SDK * [CHORE] Update SDK * Update SDK * fix merge develop Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Single message thread inserting thread without rid (#1999) * [FIX] ThreadMessagesView crashing on load (#1997) * [FIX] Saml (#1996) * [FIX] SAML incorrect close * [FIX] Pathname Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Change user own status (#1995) * [FIX] Change user own status * [IMPROVEMENT] Set activeUsers Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Loading all updated rooms after app resume (#1998) * [FIX] Loading all updated rooms after app resume * Fix room date on RoomItem Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Change notifications preferences (#2000) * [FIX] Change notifications preferences * [IMPROVEMENT] Picker View * [I18N] Translations * [FIX] Picker Selection * [FIX] List border * [FIX] Prevent crash * [FIX] Not-Pref tablet * [FIX] Use same style of LanguageView * [IMPROVEMENT] Send listItem title Co-authored-by: Diego Mello <diegolmello@gmail.com> * Bump version to 4.6.1 (#2001) * [FIX] DM header blink (#2011) * [FIX] Split get settings into two requests (#2017) * [FIX] Split get settings into two requests * [FIX] Clear settings only when change server * [IMPROVEMENT] Move the way to clear settings * [REVERT] Revert some changes * [FIX] Server Icon Co-authored-by: Diego Mello <diegolmello@gmail.com> * [REGRESSION] Invite Links (#2007) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Read only channel/broadcast (#1951) * [FIX] Read only channel/broadcast * [FIX] Roles missing * [FIX] Check roles to readOnly * [FIX] Can post * [FIX] Respect post-readonly permission * [FIX] Search a room readOnly Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Cas auth (#2024) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Login TOTP Compatibility to older servers (#2018) * [FIX] Login TOTP Compatibility to older servers * [FIX] Android crashes if use double negation Co-authored-by: Diego Mello <diegolmello@gmail.com> * Bump version to 4.6.4 (#2029) Co-authored-by: Diego Mello <diegolmello@gmail.com> * [FIX] Lint (#2030) * [FIX] UIKit with only one block (#2022) * [FIX] Message with only one block * [FIX] Update headers Co-authored-by: Diego Mello <diegolmello@gmail.com> Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> Co-authored-by: Prateek Jain <44807945+Prateek93a@users.noreply.github.com> Co-authored-by: Pitstopper <18574776+Pitstopper@users.noreply.github.com> Co-authored-by: phriedrich <info@phriedrich.de> Co-authored-by: Guilherme Siqueira <guilhersiqueira@gmail.com> Co-authored-by: Prateek Jain <prateek93a@gmail.com> Co-authored-by: devyaniChoubey <52153085+devyaniChoubey@users.noreply.github.com> Co-authored-by: Bernard Seow <ssbing99@gmail.com> Co-authored-by: Hiroki Ishiura <ishiura@ja2.so-net.ne.jp> Co-authored-by: Exordian <jakob.englisch@gmail.com> Co-authored-by: Daanchaam <daanhendriks97@gmail.com> Co-authored-by: Youssef Muhamad <emaildeyoussefmuhamad@gmail.com> Co-authored-by: Iván Álvarez <ialvarezpereira@gmail.com> Co-authored-by: Sarthak Pranesh <41206172+sarthakpranesh@users.noreply.github.com> Co-authored-by: Michele Pellegrini <pellettiero@users.noreply.github.com> Co-authored-by: Tanmoy Bhowmik <tanmoy.openroot@gmail.com> Co-authored-by: Hibikine Kage <14365761+hibikine@users.noreply.github.com> Co-authored-by: Ezequiel de Oliveira <ezequiel1de1oliveira@gmail.com> Co-authored-by: Neil Agarwal <neil@neilagarwal.me> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Govind Dixit <GOVINDDIXIT93@GMAIL.COM> Co-authored-by: Zhaubassarova Aruzhan <49000079+azhaubassar@users.noreply.github.com> Co-authored-by: Aroo <azhaubassar@gmail.com> Co-authored-by: Sarthak Pranesh <sarthak.pranesh2018@vitstudent.ac.in>
This commit is contained in:
parent
230c3364a2
commit
933362eca1
|
@ -138,7 +138,7 @@ android {
|
|||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode VERSIONCODE as Integer
|
||||
versionName "4.6.1"
|
||||
versionName "4.6.4"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ const TwoFactor = React.memo(({ theme, split }) => {
|
|||
|
||||
useDeepCompareEffect(() => {
|
||||
if (!_.isEmpty(data)) {
|
||||
setCode('');
|
||||
setVisible(true);
|
||||
} else {
|
||||
setVisible(false);
|
||||
|
@ -94,7 +95,7 @@ const TwoFactor = React.memo(({ theme, split }) => {
|
|||
<View style={styles.container}>
|
||||
<View style={[styles.content, split && [sharedStyles.modal, sharedStyles.modalFormSheet], { backgroundColor: themes[theme].backgroundColor }]}>
|
||||
<Text style={[styles.title, { color }]}>{I18n.t(method?.title || 'Two_Factor_Authentication')}</Text>
|
||||
<Text style={[styles.subtitle, { color }]}>{I18n.t(method?.text)}</Text>
|
||||
{method?.text ? <Text style={[styles.subtitle, { color }]}>{I18n.t(method.text)}</Text> : null}
|
||||
<TextInput
|
||||
value={code}
|
||||
theme={theme}
|
||||
|
|
|
@ -15,11 +15,12 @@ export default StyleSheet.create({
|
|||
},
|
||||
title: {
|
||||
fontSize: 14,
|
||||
paddingBottom: 8,
|
||||
...sharedStyles.textBold
|
||||
},
|
||||
subtitle: {
|
||||
fontSize: 14,
|
||||
paddingVertical: 8,
|
||||
paddingBottom: 8,
|
||||
...sharedStyles.textRegular,
|
||||
...sharedStyles.textAlignCenter
|
||||
},
|
||||
|
|
|
@ -6,8 +6,7 @@ const Blocks = React.memo(({
|
|||
blocks, id: mid, rid, blockAction
|
||||
}) => {
|
||||
if (blocks && blocks.length > 0) {
|
||||
const [, secondBlock] = blocks;
|
||||
const { appId = '' } = secondBlock;
|
||||
const appId = blocks[0]?.appId || '';
|
||||
return React.createElement(
|
||||
messageBlockWithContext({
|
||||
action: async({ actionId, value, blockId }) => {
|
||||
|
|
|
@ -79,7 +79,8 @@ class DB {
|
|||
Message,
|
||||
Thread,
|
||||
ThreadMessage,
|
||||
Upload
|
||||
Upload,
|
||||
Permission
|
||||
],
|
||||
actionsEnabled: true
|
||||
});
|
||||
|
|
|
@ -61,8 +61,15 @@ export default async function canOpenRoom({ rid, path }) {
|
|||
|
||||
if (rid) {
|
||||
try {
|
||||
await subsCollection.find(rid);
|
||||
return { rid };
|
||||
const room = await subsCollection.find(rid);
|
||||
return {
|
||||
rid,
|
||||
t: room.t,
|
||||
name: room.name,
|
||||
fname: room.fname,
|
||||
prid: room.prid,
|
||||
uids: room.uids
|
||||
};
|
||||
} catch (e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
|
|
@ -13,6 +13,22 @@ import fetch from '../../utils/fetch';
|
|||
|
||||
const serverInfoKeys = ['Site_Name', 'UI_Use_Real_Name', 'FileUpload_MediaTypeWhiteList', 'FileUpload_MaxFileSize'];
|
||||
|
||||
// these settings are used only on onboarding process
|
||||
const loginSettings = [
|
||||
'API_Gitlab_URL',
|
||||
'CAS_enabled',
|
||||
'CAS_login_url',
|
||||
'Accounts_EmailVerification',
|
||||
'Accounts_ManuallyApproveNewUsers',
|
||||
'Accounts_ShowFormLogin',
|
||||
'Site_Url',
|
||||
'Accounts_RegistrationForm',
|
||||
'Accounts_RegistrationForm_LinkReplacementText',
|
||||
'Accounts_EmailOrUsernamePlaceholder',
|
||||
'Accounts_PasswordPlaceholder',
|
||||
'Accounts_PasswordReset'
|
||||
];
|
||||
|
||||
const serverInfoUpdate = async(serverInfo, iconSetting) => {
|
||||
const serversDB = database.servers;
|
||||
const serverId = reduxStore.getState().server.server;
|
||||
|
@ -54,7 +70,7 @@ const serverInfoUpdate = async(serverInfo, iconSetting) => {
|
|||
|
||||
export async function getLoginSettings({ server }) {
|
||||
try {
|
||||
const settingsParams = JSON.stringify(['Accounts_ShowFormLogin', 'Accounts_RegistrationForm']);
|
||||
const settingsParams = JSON.stringify(loginSettings);
|
||||
const result = await fetch(`${ server }/api/v1/settings.public?query={"_id":{"$in":${ settingsParams }}}`).then(response => response.json());
|
||||
|
||||
if (result.success && result.settings.length) {
|
||||
|
@ -84,7 +100,7 @@ export async function setSettings() {
|
|||
export default async function() {
|
||||
try {
|
||||
const db = database.active;
|
||||
const settingsParams = JSON.stringify(Object.keys(settings));
|
||||
const settingsParams = JSON.stringify(Object.keys(settings).filter(key => !loginSettings.includes(key)));
|
||||
// RC 0.60.0
|
||||
const result = await fetch(`${ this.sdk.client.host }/api/v1/settings.public?query={"_id":{"$in":${ settingsParams }}}`).then(response => response.json());
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ const createOrUpdateSubscription = async(subscription, room) => {
|
|||
autoTranslate: s.autoTranslate,
|
||||
autoTranslateLanguage: s.autoTranslateLanguage,
|
||||
lastMessage: s.lastMessage,
|
||||
roles: s.roles,
|
||||
usernames: s.usernames,
|
||||
uids: s.uids
|
||||
};
|
||||
|
|
|
@ -289,14 +289,11 @@ const RocketChat = {
|
|||
user = {
|
||||
id: userRecord.id,
|
||||
token: userRecord.token,
|
||||
username: userRecord.username
|
||||
username: userRecord.username,
|
||||
roles: userRecord.roles
|
||||
};
|
||||
}
|
||||
reduxStore.dispatch(shareSetUser({
|
||||
id: user.id,
|
||||
token: user.token,
|
||||
username: user.username
|
||||
}));
|
||||
reduxStore.dispatch(shareSetUser(user));
|
||||
await RocketChat.login({ resume: user.token });
|
||||
} catch (e) {
|
||||
log(e);
|
||||
|
@ -308,6 +305,8 @@ const RocketChat = {
|
|||
this.shareSDK = null;
|
||||
}
|
||||
database.share = null;
|
||||
|
||||
reduxStore.dispatch(shareSetUser(null));
|
||||
},
|
||||
|
||||
updateJitsiTimeout(rid) {
|
||||
|
@ -338,8 +337,8 @@ const RocketChat = {
|
|||
if (e.data?.error && (e.data.error === 'totp-required' || e.data.error === 'totp-invalid')) {
|
||||
const { details } = e.data;
|
||||
try {
|
||||
await twoFactor({ method: details?.method, invalid: e.data.error === 'totp-invalid' });
|
||||
return resolve(this.loginTOTP(params));
|
||||
const code = await twoFactor({ method: details?.method || 'totp', invalid: e.data.error === 'totp-invalid' });
|
||||
return resolve(this.loginTOTP({ ...params, code: code?.twoFactorCode }));
|
||||
} catch {
|
||||
// twoFactor was canceled
|
||||
return reject();
|
||||
|
@ -580,6 +579,19 @@ const RocketChat = {
|
|||
}
|
||||
data = data.slice(0, 7);
|
||||
|
||||
data = data.map((sub) => {
|
||||
if (sub.t !== 'd') {
|
||||
return ({
|
||||
rid: sub.rid,
|
||||
name: sub.name,
|
||||
fname: sub.fname,
|
||||
t: sub.t,
|
||||
search: true
|
||||
});
|
||||
}
|
||||
return sub;
|
||||
});
|
||||
|
||||
const usernames = data.map(sub => sub.name);
|
||||
try {
|
||||
if (data.length < 7) {
|
||||
|
@ -812,7 +824,9 @@ const RocketChat = {
|
|||
return this.sdk.get('rooms.info', { roomId });
|
||||
},
|
||||
|
||||
getUidDirectMessage(room, userId) {
|
||||
getUidDirectMessage(room) {
|
||||
const { id: userId } = reduxStore.getState().login.user;
|
||||
|
||||
// legacy method
|
||||
if (!room.uids && room.rid && room.t === 'd') {
|
||||
return room.rid.replace(userId, '').trim();
|
||||
|
@ -949,7 +963,7 @@ const RocketChat = {
|
|||
// get the room from database
|
||||
const room = await subsCollection.find(rid);
|
||||
// get room roles
|
||||
roomRoles = room.roles;
|
||||
roomRoles = room.roles || [];
|
||||
} catch (error) {
|
||||
console.log('hasPermission -> Room not found');
|
||||
return permissions.reduce((result, permission) => {
|
||||
|
@ -960,8 +974,10 @@ const RocketChat = {
|
|||
// get permissions from database
|
||||
try {
|
||||
const permissionsFiltered = await permissionsCollection.query(Q.where('id', Q.oneOf(permissions))).fetch();
|
||||
const shareUser = reduxStore.getState().share.user;
|
||||
const loginUser = reduxStore.getState().login.user;
|
||||
// get user roles on the server from redux
|
||||
const userRoles = (reduxStore.getState().login.user && reduxStore.getState().login.user.roles) || [];
|
||||
const userRoles = (shareUser.roles || loginUser.roles) || [];
|
||||
// merge both roles
|
||||
const mergedRoles = [...new Set([...roomRoles, ...userRoles])];
|
||||
|
||||
|
|
|
@ -30,14 +30,21 @@ const handleInviteLink = function* handleInviteLink({ params, requireLogin = fal
|
|||
const navigate = function* navigate({ params }) {
|
||||
yield put(appStart('inside'));
|
||||
if (params.path) {
|
||||
const room = yield RocketChat.canOpenRoom(params);
|
||||
const [type, name] = params.path.split('/');
|
||||
if (room) {
|
||||
yield Navigation.navigate('RoomsListView');
|
||||
Navigation.navigate('RoomView', { name, t: roomTypes[type], ...room });
|
||||
if (type !== 'invite') {
|
||||
const room = yield RocketChat.canOpenRoom(params);
|
||||
if (room) {
|
||||
yield Navigation.navigate('RoomsListView');
|
||||
Navigation.navigate('RoomView', {
|
||||
name,
|
||||
t: roomTypes[type],
|
||||
roomUserId: RocketChat.getUidDirectMessage(room),
|
||||
...room
|
||||
});
|
||||
}
|
||||
} else {
|
||||
yield handleInviteLink({ params });
|
||||
}
|
||||
} else {
|
||||
yield handleInviteLink({ params });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import * as actions from '../actions';
|
|||
import {
|
||||
serverFailure, selectServerRequest, selectServerSuccess, selectServerFailure
|
||||
} from '../actions/server';
|
||||
import { setUser } from '../actions/login';
|
||||
import { clearSettings } from '../actions/settings';
|
||||
import { setUser } from '../actions/login';
|
||||
import RocketChat from '../lib/rocketchat';
|
||||
import database from '../lib/database';
|
||||
import log, { logServerVersion } from '../utils/log';
|
||||
|
@ -98,9 +98,8 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
|
|||
const basicAuth = yield RNUserDefaults.get(`${ BASIC_AUTH_KEY }-${ server }`);
|
||||
setBasicAuth(basicAuth);
|
||||
|
||||
yield put(clearSettings());
|
||||
|
||||
if (user) {
|
||||
yield put(clearSettings());
|
||||
yield RocketChat.connect({ server, user, logoutOnError: true });
|
||||
yield put(setUser(user));
|
||||
yield put(actions.appStart('inside'));
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
import RocketChat from '../lib/rocketchat';
|
||||
|
||||
const canPost = async({ rid }) => {
|
||||
try {
|
||||
const permission = await RocketChat.hasPermission(['post-readonly'], rid);
|
||||
return permission && permission['post-readonly'];
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const isMuted = (room, user) => room && room.muted && room.muted.find && !!room.muted.find(m => m === user.username);
|
||||
|
||||
export const isReadOnly = async(room, user) => {
|
||||
if (room.archived) {
|
||||
return true;
|
||||
}
|
||||
const allowPost = await canPost(room);
|
||||
if (allowPost) {
|
||||
return false;
|
||||
}
|
||||
return (room && room.ro) || isMuted(room, user);
|
||||
};
|
|
@ -2,17 +2,6 @@ import moment from 'moment';
|
|||
|
||||
import I18n from '../i18n';
|
||||
|
||||
export const isOwner = room => room && room.roles && room.roles.length && !!room.roles.find(role => role === 'owner');
|
||||
|
||||
export const isMuted = (room, user) => room && room.muted && room.muted.find && !!room.muted.find(m => m === user.username);
|
||||
|
||||
export const isReadOnly = (room, user) => {
|
||||
if (isOwner(room)) {
|
||||
return false;
|
||||
}
|
||||
return (room && room.ro) || isMuted(room, user);
|
||||
};
|
||||
|
||||
export const isBlocked = (room) => {
|
||||
if (room) {
|
||||
const { t, blocked, blocker } = room;
|
||||
|
|
|
@ -80,7 +80,8 @@ class AuthenticationWebView extends React.PureComponent {
|
|||
const { navigation } = this.props;
|
||||
const ssoToken = navigation.getParam('ssoToken');
|
||||
const parsedUrl = parse(url, true);
|
||||
if (parsedUrl.pathname?.includes('ticket') || parsedUrl.pathname?.includes('validate') || parsedUrl.query?.saml_idp_credentialToken) {
|
||||
// ticket -> cas / validate & saml_idp_credentialToken -> saml
|
||||
if (parsedUrl.pathname?.includes('validate') || parsedUrl.query?.ticket || parsedUrl.query?.saml_idp_credentialToken) {
|
||||
let payload;
|
||||
if (this.authType === 'saml') {
|
||||
const token = parsedUrl.query?.saml_idp_credentialToken || ssoToken;
|
||||
|
|
|
@ -125,10 +125,14 @@ class DirectoryView extends React.Component {
|
|||
this.setState(({ showOptionsDropdown }) => ({ showOptionsDropdown: !showOptionsDropdown }));
|
||||
}
|
||||
|
||||
goRoom = async({ rid, name, t }) => {
|
||||
goRoom = async({
|
||||
rid, name, t, search
|
||||
}) => {
|
||||
const { navigation } = this.props;
|
||||
await navigation.navigate('RoomsListView');
|
||||
navigation.navigate('RoomView', { rid, name, t });
|
||||
navigation.navigate('RoomView', {
|
||||
rid, name, t, search
|
||||
});
|
||||
}
|
||||
|
||||
onPressItem = async(item) => {
|
||||
|
@ -139,7 +143,9 @@ class DirectoryView extends React.Component {
|
|||
this.goRoom({ rid: result.room._id, name: item.username, t: 'd' });
|
||||
}
|
||||
} else {
|
||||
this.goRoom({ rid: item._id, name: item.name, t: 'c' });
|
||||
this.goRoom({
|
||||
rid: item._id, name: item.name, t: 'c', search: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class ModalBlockView extends React.Component {
|
|||
return {
|
||||
title: textParser([title]),
|
||||
...themedHeader(theme),
|
||||
headerLeft: (
|
||||
headerLeft: close ? (
|
||||
<CustomHeaderButtons>
|
||||
<Item
|
||||
title={textParser([close.text])}
|
||||
|
@ -76,8 +76,8 @@ class ModalBlockView extends React.Component {
|
|||
testID='close-modal-uikit'
|
||||
/>
|
||||
</CustomHeaderButtons>
|
||||
),
|
||||
headerRight: (
|
||||
) : null,
|
||||
headerRight: submit ? (
|
||||
<CustomHeaderButtons>
|
||||
<Item
|
||||
title={textParser([submit.text])}
|
||||
|
@ -86,7 +86,7 @@ class ModalBlockView extends React.Component {
|
|||
testID='submit-modal-uikit'
|
||||
/>
|
||||
</CustomHeaderButtons>
|
||||
)
|
||||
) : null
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ class ModalBlockView extends React.Component {
|
|||
const { navigation } = this.props;
|
||||
const oldData = prevProps.navigation.getParam('data', {});
|
||||
const newData = navigation.getParam('data', {});
|
||||
if (!isEqual(oldData, newData)) {
|
||||
if (oldData.viewId !== newData.viewId) {
|
||||
navigation.push('ModalBlockView', { data: newData });
|
||||
}
|
||||
}
|
||||
|
@ -148,12 +148,14 @@ class ModalBlockView extends React.Component {
|
|||
}
|
||||
|
||||
handleUpdate = ({ type, ...data }) => {
|
||||
const { navigation } = this.props;
|
||||
if ([MODAL_ACTIONS.ERRORS].includes(type)) {
|
||||
const { errors } = data;
|
||||
this.setState({ errors });
|
||||
} else {
|
||||
this.setState({ data });
|
||||
}
|
||||
navigation.setParams({ data });
|
||||
};
|
||||
|
||||
cancel = async({ closeModal }) => {
|
||||
|
|
|
@ -384,11 +384,10 @@ class RoomActionsView extends React.Component {
|
|||
|
||||
updateRoomMember = async() => {
|
||||
const { room } = this.state;
|
||||
const { user } = this.props;
|
||||
|
||||
try {
|
||||
if (!RocketChat.isGroupChat(room)) {
|
||||
const roomUserId = RocketChat.getUidDirectMessage(room, user.id);
|
||||
const roomUserId = RocketChat.getUidDirectMessage(room);
|
||||
const result = await RocketChat.getUserInfo(roomUserId);
|
||||
if (result.success) {
|
||||
this.setState({ member: result.user });
|
||||
|
|
|
@ -34,7 +34,8 @@ import { themes } from '../../constants/colors';
|
|||
import debounce from '../../utils/debounce';
|
||||
import ReactionsModal from '../../containers/ReactionsModal';
|
||||
import { LISTENER } from '../../containers/Toast';
|
||||
import { isReadOnly, isBlocked } from '../../utils/room';
|
||||
import { isBlocked } from '../../utils/room';
|
||||
import { isReadOnly } from '../../utils/isReadOnly';
|
||||
import { isIOS, isTablet } from '../../utils/deviceInfo';
|
||||
import { showErrorAlert } from '../../utils/info';
|
||||
import { withTheme } from '../../theme';
|
||||
|
@ -65,9 +66,10 @@ const stateAttrsUpdate = [
|
|||
'editing',
|
||||
'replying',
|
||||
'reacting',
|
||||
'readOnly',
|
||||
'member'
|
||||
];
|
||||
const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'muted', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname'];
|
||||
const roomAttrsUpdate = ['f', 'ro', 'blocked', 'blocker', 'archived', 'muted', 'jitsiTimeout', 'announcement', 'sysMes', 'topic', 'name', 'fname', 'roles'];
|
||||
|
||||
class RoomView extends React.Component {
|
||||
static navigationOptions = ({ navigation, screenProps }) => {
|
||||
|
@ -164,6 +166,7 @@ class RoomView extends React.Component {
|
|||
const selectedMessage = props.navigation.getParam('message');
|
||||
const name = props.navigation.getParam('name');
|
||||
const fname = props.navigation.getParam('fname');
|
||||
const search = props.navigation.getParam('search');
|
||||
const prid = props.navigation.getParam('prid');
|
||||
this.state = {
|
||||
joined: true,
|
||||
|
@ -183,7 +186,7 @@ class RoomView extends React.Component {
|
|||
replying: !!selectedMessage,
|
||||
replyWithMention: false,
|
||||
reacting: false,
|
||||
announcement: null
|
||||
readOnly: false
|
||||
};
|
||||
|
||||
if (room && room.observe) {
|
||||
|
@ -192,6 +195,12 @@ class RoomView extends React.Component {
|
|||
this.findAndObserveRoom(this.rid);
|
||||
}
|
||||
|
||||
this.setReadOnly();
|
||||
|
||||
if (search) {
|
||||
this.updateRoom();
|
||||
}
|
||||
|
||||
this.messagebox = React.createRef();
|
||||
this.list = React.createRef();
|
||||
this.mounted = false;
|
||||
|
@ -278,6 +287,9 @@ class RoomView extends React.Component {
|
|||
if (roomUpdate.topic !== prevState.roomUpdate.topic) {
|
||||
navigation.setParams({ subtitle: roomUpdate.topic });
|
||||
}
|
||||
if (!isEqual(prevState.roomUpdate.roles, roomUpdate.roles)) {
|
||||
this.setReadOnly();
|
||||
}
|
||||
}
|
||||
if (((roomUpdate.fname !== prevState.roomUpdate.fname) || (roomUpdate.name !== prevState.roomUpdate.name)) && !this.tmid) {
|
||||
navigation.setParams({ name: this.getRoomTitle(room) });
|
||||
|
@ -346,6 +358,32 @@ class RoomView extends React.Component {
|
|||
});
|
||||
}
|
||||
|
||||
setReadOnly = async() => {
|
||||
const { room } = this.state;
|
||||
const { user } = this.props;
|
||||
const readOnly = await isReadOnly(room, user);
|
||||
this.setState({ readOnly });
|
||||
}
|
||||
|
||||
updateRoom = async() => {
|
||||
const db = database.active;
|
||||
|
||||
try {
|
||||
const subCollection = db.collections.get('subscriptions');
|
||||
const sub = await subCollection.find(this.rid);
|
||||
|
||||
const { room } = await RocketChat.getRoomInfo(this.rid);
|
||||
|
||||
await db.action(async() => {
|
||||
await sub.update((s) => {
|
||||
Object.assign(s, room);
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
init = async() => {
|
||||
try {
|
||||
this.setState({ loading: true });
|
||||
|
@ -390,10 +428,10 @@ class RoomView extends React.Component {
|
|||
const { t } = room;
|
||||
|
||||
if (t === 'd' && !RocketChat.isGroupChat(room)) {
|
||||
const { user, navigation } = this.props;
|
||||
const { navigation } = this.props;
|
||||
|
||||
try {
|
||||
const roomUserId = RocketChat.getUidDirectMessage(room, user.id);
|
||||
const roomUserId = RocketChat.getUidDirectMessage(room);
|
||||
|
||||
navigation.setParams({ roomUserId });
|
||||
|
||||
|
@ -762,12 +800,6 @@ class RoomView extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
get isReadOnly() {
|
||||
const { room } = this.state;
|
||||
const { user } = this.props;
|
||||
return isReadOnly(room, user);
|
||||
}
|
||||
|
||||
blockAction = ({
|
||||
actionId, appId, value, blockId, rid, mid
|
||||
}) => RocketChat.triggerBlockAction({
|
||||
|
@ -855,7 +887,7 @@ class RoomView extends React.Component {
|
|||
|
||||
renderFooter = () => {
|
||||
const {
|
||||
joined, room, selectedMessage, editing, replying, replyWithMention
|
||||
joined, room, selectedMessage, editing, replying, replyWithMention, readOnly
|
||||
} = this.state;
|
||||
const { navigation, theme } = this.props;
|
||||
|
||||
|
@ -876,7 +908,7 @@ class RoomView extends React.Component {
|
|||
</View>
|
||||
);
|
||||
}
|
||||
if (this.isReadOnly || room.archived) {
|
||||
if (readOnly) {
|
||||
return (
|
||||
<View style={styles.readOnly}>
|
||||
<Text style={[styles.previewMode, { color: themes[theme].titleText }]} accessibilityLabel={I18n.t('This_room_is_read_only')}>{I18n.t('This_room_is_read_only')}</Text>
|
||||
|
@ -914,7 +946,7 @@ class RoomView extends React.Component {
|
|||
|
||||
renderActions = () => {
|
||||
const {
|
||||
room, selectedMessage, showActions, showErrorActions, joined
|
||||
room, selectedMessage, showActions, showErrorActions, joined, readOnly
|
||||
} = this.state;
|
||||
const {
|
||||
user, navigation
|
||||
|
@ -935,7 +967,7 @@ class RoomView extends React.Component {
|
|||
editInit={this.onEditInit}
|
||||
replyInit={this.onReplyInit}
|
||||
reactionInit={this.onReactionInit}
|
||||
isReadOnly={this.isReadOnly}
|
||||
isReadOnly={readOnly}
|
||||
/>
|
||||
)
|
||||
: null
|
||||
|
|
|
@ -531,10 +531,7 @@ class RoomsListView extends React.Component {
|
|||
|
||||
getUserPresence = uid => RocketChat.getUserPresence(uid)
|
||||
|
||||
getUidDirectMessage = (room) => {
|
||||
const { user: { id } } = this.props;
|
||||
return RocketChat.getUidDirectMessage(room, id);
|
||||
}
|
||||
getUidDirectMessage = room => RocketChat.getUidDirectMessage(room);
|
||||
|
||||
goRoom = (item) => {
|
||||
const { navigation } = this.props;
|
||||
|
@ -545,8 +542,9 @@ class RoomsListView extends React.Component {
|
|||
name: this.getRoomTitle(item),
|
||||
t: item.t,
|
||||
prid: item.prid,
|
||||
roomUserId: this.getUidDirectMessage(item),
|
||||
room: item
|
||||
room: item,
|
||||
search: item.search,
|
||||
roomUserId: this.getUidDirectMessage(item)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ import styles from './styles';
|
|||
import TextInput from '../../containers/TextInput';
|
||||
import ActivityIndicator from '../../containers/ActivityIndicator';
|
||||
import { CustomHeaderButtons, Item } from '../../containers/HeaderButton';
|
||||
import { isReadOnly, isBlocked } from '../../utils/room';
|
||||
import { isBlocked } from '../../utils/room';
|
||||
import { isReadOnly } from '../../utils/isReadOnly';
|
||||
import { withTheme } from '../../theme';
|
||||
import { themedHeader } from '../../utils/navigation';
|
||||
|
||||
|
@ -69,18 +70,29 @@ class ShareView extends React.Component {
|
|||
fileInfo,
|
||||
room,
|
||||
loading: false,
|
||||
readOnly: false,
|
||||
file: {
|
||||
name: fileInfo ? fileInfo.name : '',
|
||||
description: ''
|
||||
}
|
||||
};
|
||||
|
||||
this.setReadOnly();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { navigation } = this.props;
|
||||
navigation.setParams({ sendMessage: this._sendMessage });
|
||||
}
|
||||
|
||||
setReadOnly = async() => {
|
||||
const { room } = this.state;
|
||||
const { navigation, user } = this.props;
|
||||
const { username } = user;
|
||||
navigation.setParams({ sendMessage: this._sendMessage, canSend: !(isReadOnly(room, { username }) || isBlocked(room)) });
|
||||
const readOnly = await isReadOnly(room, { username });
|
||||
|
||||
this.setState({ readOnly });
|
||||
navigation.setParams({ canSend: !(readOnly || isBlocked(room)) });
|
||||
}
|
||||
|
||||
bytesToSize = bytes => `${ (bytes / 1048576).toFixed(2) }MB`;
|
||||
|
@ -237,8 +249,9 @@ class ShareView extends React.Component {
|
|||
|
||||
renderError = () => {
|
||||
const { room } = this.state;
|
||||
const { theme } = this.props;
|
||||
return (
|
||||
<View style={[styles.container, styles.centered]}>
|
||||
<View style={[styles.container, styles.centered, { backgroundColor: themes[theme].backgroundColor }]}>
|
||||
<Text style={styles.title}>
|
||||
{
|
||||
isBlocked(room) ? I18n.t('This_room_is_blocked') : I18n.t('This_room_is_read_only')
|
||||
|
@ -249,13 +262,12 @@ class ShareView extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { user, theme } = this.props;
|
||||
const { username } = user;
|
||||
const { theme } = this.props;
|
||||
const {
|
||||
name, loading, isMedia, room
|
||||
name, loading, isMedia, room, readOnly
|
||||
} = this.state;
|
||||
|
||||
if (isReadOnly(room, { username }) || isBlocked(room)) {
|
||||
if (readOnly || isBlocked(room)) {
|
||||
return this.renderError();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "SocketRocket",
|
||||
"version": "0.5.1",
|
||||
"summary": "A conforming WebSocket (RFC 6455) client library for iOS, macOS and tvOS.",
|
||||
"homepage": "https://github.com/facebook/SocketRocket",
|
||||
"authors": {
|
||||
"Nikita Lutsenko": "nlutsenko@me.com",
|
||||
"Dan Federman": "federman@squareup.com",
|
||||
"Mike Lewis": "mikelikespie@gmail.com"
|
||||
},
|
||||
"license": "BSD",
|
||||
"source": {
|
||||
"git": "https://github.com/facebook/SocketRocket.git",
|
||||
"tag": "0.5.1"
|
||||
},
|
||||
"requires_arc": true,
|
||||
"source_files": "SocketRocket/**/*.{h,m}",
|
||||
"public_header_files": "SocketRocket/*.h",
|
||||
"platforms": {
|
||||
"ios": "6.0",
|
||||
"osx": "10.8",
|
||||
"tvos": "9.0"
|
||||
},
|
||||
"ios": {
|
||||
"frameworks": [
|
||||
"CFNetwork",
|
||||
"Security"
|
||||
]
|
||||
},
|
||||
"osx": {
|
||||
"frameworks": [
|
||||
"CoreServices",
|
||||
"Security"
|
||||
]
|
||||
},
|
||||
"tvos": {
|
||||
"frameworks": [
|
||||
"CFNetwork",
|
||||
"Security"
|
||||
]
|
||||
},
|
||||
"libraries": "icucore"
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "Yoga",
|
||||
"version": "1.14.0",
|
||||
"license": {
|
||||
"type": "MIT"
|
||||
},
|
||||
"homepage": "https://yogalayout.com",
|
||||
"documentation_url": "https://yogalayout.com/docs/",
|
||||
"summary": "Yoga is a cross-platform layout engine which implements Flexbox.",
|
||||
"description": "Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.",
|
||||
"authors": "Facebook",
|
||||
"source": {
|
||||
"git": "https://github.com/facebook/react-native.git",
|
||||
"tag": "v0.61.5"
|
||||
},
|
||||
"module_name": "yoga",
|
||||
"header_dir": "yoga",
|
||||
"requires_arc": false,
|
||||
"compiler_flags": [
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fexceptions",
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-std=c++1y",
|
||||
"-fPIC"
|
||||
],
|
||||
"platforms": {
|
||||
"ios": "9.0",
|
||||
"tvos": "9.2"
|
||||
},
|
||||
"source_files": "yoga/**/*.{cpp,h}",
|
||||
"public_header_files": "yoga/{Yoga,YGEnums,YGMacros,YGValue}.h"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
@interface PodsDummy_Yoga : NSObject
|
||||
@end
|
||||
@implementation PodsDummy_Yoga
|
||||
@end
|
|
@ -0,0 +1,11 @@
|
|||
APPLICATION_EXTENSION_API_ONLY = YES
|
||||
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Yoga
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
|
||||
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Yoga" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Yoga"
|
||||
PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_ROOT = ${SRCROOT}
|
||||
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../node_modules/react-native/ReactCommon/yoga
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
|
||||
SKIP_INSTALL = YES
|
||||
USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
|
|
@ -19,7 +19,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.6.1</string>
|
||||
<string>4.6.4</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>4.6.1</string>
|
||||
<string>4.6.4</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
|
|
Loading…
Reference in New Issue