Skip to content

Commit bba1505

Browse files
khushal87isekovanicsemantic-release-bottestableappleStream-SDK-Bot
authored
feat: mark as unread and mark as read improvements (#2833)
* fix: remove netinfo from native handlers and add it as dev dependency of core (#2538) * fix: add expo-clipboard to peer deps of expo-package (#2537) * fix: remove netinfo from native handlers and add it as dev dependency of core * fix: lint issues * fix: revert back isMounted logic * fix: change peer dep * feat: remove usage of flatlist-mvcp in favour of mvcp support in RN >= 0.72 (#2539) * fix: add expo-clipboard to peer deps of expo-package (#2537) * feat: remove usage of flatlist-mvcp in favour of mvcp support in RN >= 0.72 * fix: remove flatlist-mvcp from example apps * chore: update peer dep of react native * fix: change quotedMessage type to MessageType or undefined (#2527) * fix: change quotedMessage type to MessageType or undefined * docs: fix lint issues * fix: change react-native-image-resizer to @bam.tech/react-native-image-resizer (#2534) * fix: reaction list reactions sorting order based on created_at * fix: show reactions using reactions_group * fix: tests * fix: useProcessReactions hook * fix: useProcessReactions hook and Channel message spread * fix: change react-native-image-resizer to @bam.tech/react-native-image-resizer * fix: remove reaction_counts from offline DB * chore: update yarn.lock files * fix: add reanimated and gesture handler as peer deps to package * fix: change old gesture handler useAnimatedGestureHandler to the new API (#2563) * feat: configure ReactionList reaction theme (#2561) * fix: expo sample app keyboardVerticalOffset for channel and thread screen * fix: change old gesture handler useAnimatedGestureHandler to the new API * feat: move react-native-quick-sqlite to op-sqlite (#2541) * feat: move react-native-quick-sqlite to op-sqlite * docs: update docs * fix: podfile changes * docs: add troubleshoot guide * fix: issues with import * fix: update yarn.lock * chore: update deps of expo messaging app * feat: use react-native-blob-util instead of the react-native-fs and make it optional dependency (#2578) * feat: use react-native-blob-util instead of the react-native-fs and make it optional dependency * chore: fix peerdeps and add dcos * fix: deps version on package.json * docs: add migration guide for v5 to v6 * docs: add migration guide for v5 to v6 * docs: add migration guide for v5 to v6 * fix: upgrade cameraroll, documentpicker, haptics feedback and image crop picker to new arch compatible version * fix: change react-native-image-crop-picker to react-native-image-picker and make it optional * docs: add migration guide * fix: make expo-image-picker optional * fix: make expo-image-picker optional * docs: apply docs changes * fix: add check for handlers in native.ts * fix: resolve conflicts from branch develop to v6 (#2621) * fix: resolve conflicts from branch develop to v6 * fix: remove cameraroll on ts messaging app * fix: remove shared folder * chore: bump vale version * chore: bump vale version * chore: update vale version * chore: resolve conflicts from develop * chore: fix vale issues * chore: fix vale issues * fix: react-native-safe-area-context ios build issue * fix: bottom sheet version * fix: remove flipper debugger * fix: issue with rn-svg on android and rn-video fabric compatibility * fix: animations usage in ImageGallery (#2627) * fix: remove rn-sqlite patch * fix: animations laginess on the ImageGallery and MessageOverlay on new architecture (#2633) * chore: resolve conflicts from develop (#2682) * fix: upgrade firebase versions to fix crash (#2646) * fix: audio recording variety bugs (#2648) * fix: variety of bugs in async audio feature * fix: upload of empty messages and console.log cleanup * fix: expo permission race conditions * fix: create pure version of stopRecording() for usage on unmount * fix: remove redundant export * fix: actually amend failing test suites * chore: remove constructors as they are not needed * fix: pr remarks * chore: write some simplistic functionality tests * chore: return class instance rather than class itself for better usability * chore: add more robust tests * fix: linter errors * fix: only display waveform whenever the mic is locked * docs: add Deep Linking guide for the chat SDK (#2651) * fix: change Block user action to Ban user action and UI cookbook for blocking users (#2649) * fix: change Block user action to Ban user action * fix: change Block user action to Ban user action * fix: add back blockUser action and deprecate it * docs: UI Cookbook for Blocking users * chore(release): 5.36.1 [skip ci] * chore(release): 1.28.1 [skip ci] * fix: issue with loading app settings when the connectUser is not called on app (#2654) * fix: issue with loading app settings when the connectUser is not called on app * fix: add comments * fix: add comments * fix: unable to upload file due to special characters in the file name (#2656) * fix: sdk size pr (#2657) * [CI] Update SDK Size (#2653) Co-authored-by: Khushal Agarwal <khushal.agarwal987@gmail.com> Co-authored-by: Stream Bot <runner@fv-az1148-731.o3ts4yn1huletmfehy03vvfvxg.dx.internal.cloudapp.net> * chore(release): 5.36.2 [skip ci] * chore(release): 1.28.2 [skip ci] * feat: add live location sharing cookbook (#2659) * feat: add live location ui cookbook * fix: prettier lint * Update docusaurus/docs/reactnative/guides/live-location-sharing.mdx Co-authored-by: Oliver Lazoroski <oliver.lazoroski@gmail.com> * lint fixes * fix lint issues * fix locks * move to ruby 3.1 and greater --------- Co-authored-by: Oliver Lazoroski <oliver.lazoroski@gmail.com> * chore(release): 5.37.0 [skip ci] * chore(release): 1.29.0 [skip ci] * fix: avoid prepending http before native supported url schemes (#2661) * fix: avoid prepending http before native supported url schemes * fix: move check to link parsing module * fix: bad memoisation in window, screen dimension listener hooks (#2664) * fix: bad memoisation in window, screen dimension listener hooks * remove unused variable * feat: add create chat client hook for easy usage (#2660) * feat: add create chat client hook for easy usage * docs: use useCreateChatClient hook for client creation * fix: bump fastlane plugin version (#2665) * fix: add theme properties for EmptyStateIndicator for message list (#2667) * fix: add theme properties for EmptyStateIndicator for message list * fix: update snapshots * fix: apply card cover theme property order * fix: pagination typescript errors and db synchronization bugs (#2669) * fix: pagination typescript errors and db synchronization bugs * chore: write test for db serialization issue * fix: linter issues * [CI] Bump max tolerance for sdk size analysis (#2674) * chore: bump sample app version to v1.30.0 * fix: remove nin and ne operator usage in the SDK and the sample app (#2672) * fix: remove and operator usage in the SDK and the sample app * fix: remove console log * fix: change console log to warn * fix: add improvemnts * fix: import of debouncefunc * fix: import of debouncefunc * fix: restructure queryMembers, queryUsers and ACItriggersettings * fix: error bubbling for suggestions in auto complete input * fix: request image access permissions for iOS only for native image picking (#2677) * fix: properly resolve sendMessage during memoization (#2675) * fix: properly resolve sendMessage during memoization * fix: remedy change so that it does not cause performance issues * chore: revert sendMessage in the dep array * fix: deprecate messageReactions prop and use isMessageActionsVisible instead for messageActions (#2676) * fix: deprecate messageReactions prop and use isMessageActionsVisible instead for messageActions * docs: fix custom message actions * fix: execution logic for showMessageOverlay * chore(release): 5.38.0 [skip ci] * chore(release): 1.29.1 [skip ci] * fix: update yarn.lock for the project (#2681) * fix: copy message action type for message actions (#2679) * chore: update sdk size (#2678) Co-authored-by: Khushal Agarwal <khushal.agarwal987@gmail.com> Co-authored-by: Stream Bot <runner@fv-az1756-392.rxb2ubmju23uthz3oztawtjyeg.dx.internal.cloudapp.net> * chore: resolve conflicts from develop * fix: vale lint issues * fix: new arch project config --------- Co-authored-by: Ivan Sekovanikj <31964049+isekovanic@users.noreply.github.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Alexey Alter-Pesotskiy <alex@testableapple.com> Co-authored-by: Stream SDK Bot <60655709+Stream-SDK-Bot@users.noreply.github.com> Co-authored-by: Stream Bot <runner@fv-az1148-731.o3ts4yn1huletmfehy03vvfvxg.dx.internal.cloudapp.net> Co-authored-by: Santhosh Vaiyapuri <3846977+santhoshvai@users.noreply.github.com> Co-authored-by: Oliver Lazoroski <oliver.lazoroski@gmail.com> Co-authored-by: Ivan Sekovanikj <ivan.sekovanikj@getstream.io> Co-authored-by: Stream Bot <runner@fv-az1756-392.rxb2ubmju23uthz3oztawtjyeg.dx.internal.cloudapp.net> * fix: chat.test.ts * chore: cleanup v3 docs setup and e2e tests from project (#2701) * feat: add new message action list and reaction selector UI (#2686) * feat: remove StreamChatRN in favour of a global context ChatConfigContext that allows providing global values (#2703) * fix: remove deprecated code from v6 branch (#2702) * fix: remove deprecated code from v6 branch * fix: remove deprecated code from v6 branch * docs: add deprecated docs * docs: add deprecated docs * chore: resolve conflicts from base branch * docs: improve deprecated docs * chore: resolve conflicts from develop * feat: new reaction list design and improvements to MessageSimple component (#2700) * feat: add new message action list and reaction selector UI * fix: remove unnecessary props from OverlayContext * docs: add comments for the props * tests: add tests for the components * tests: add tests for the components * fix: chat.test.ts * fix: chat.test.ts * fix: add tests for the code * fix: use rn animated to create new modal and add docs * fix: add opacity for the message action list item when pressed * fix: make modal better and change component names * fix: update test snapdhots * docs: message actions customizations * docs: message actions customizations * fix: theme improvements * fix: message component render improvements * docs: update migration guide * feat: new reaction list design and improvements to MessageSimple component * tests: add tests for the components * docs: reaction list new design docs * docs: add changes to migration guide * docs: add changes to migration guide * docs: add changes to migration guide * chore: resolve conflicts from base branch * chore: resolve conflicts from base branch * fix: sample app overlay backdrop bug * fix: reaction list type * feat: add FlatList for Reaction Picker * feat: add FlatList for Reaction Picker * feat: add FlatList for Reaction Picker * fix: circular dependency issue * fix: upgrade expo to latest in expo messaging app * fix: padding for reaction picker * fix: update dependencies for native cli apps * fix: add Flatlist mvcp as optional package and peer deps versions (#2720) * fix: add Flatlist mvcp as optional package and peer deps versions * fix: add Flatlist mvcp as optional package and peer deps versions * docs: fix native handler docs * docs: fix vale issues * docs: remove native handler docs * fix: lint issues * fix: design issues with ReactionList bottom UI (#2717) * fix: design issues with ReactionList bottom UI * fix: vale issues * fix: add a log that complains for removal for mvcp package on RN version <0.72 (#2724) * fix: add a log that complains for removal for mvcp package on RN version <0.72 * fix: add a log that complains for removal for mvcp package on RN version <0.72 * fix: build issues * fix: add variable under the if block Co-authored-by: Oliver Lazoroski <oliver.lazoroski@gmail.com> * fix: log --------- Co-authored-by: Oliver Lazoroski <oliver.lazoroski@gmail.com> * fix: bottom sheet modal improvements * fix: use process reactions improvements for thread list * docs: docusaurus setup for v6 release (#2721) * docs: docusaurus setup for v6 release * docs: docusaurus setup for v6 release * docs: fix vale issues * docs: add v5 docs to v5 folder * chore: setup workflow and improve migration guide for v6 rc release (#2727) * fix: linting issues * featv6 rc release * feat!: v6 rc release * feat!: v6 rc release * BREAKING CHANGE: v6 rc release * fix: upgrade react native version in sample apps to 0.73.10 (#2728) * feat!: rc release v6 (#2729) * feat: styles changes for MessageActionList * feat: styles changes for MessageUserReactions * chore: fix noteKeywords in release config * feat: improve Message.tsx render conditional (#2733) BREAKING CHANGE: Update the Message.tsx conditional in the component to use ternary * feat: remove dry run mode from release config BREAKING CHANGE: Update the release config * fix: way of reading the value from animated shared values in the components (#2738) * fix: way of reading the value from animated shared values in the components * fix: unify styles to one hook * fix: lint issues * fix: upgrade the RN version in example apps to 0.75.4 (#2739) * fix: upgrade the RN version in example apps to 0.74.6 * fix: upgrade the RN version in example apps to 0.75.4 * fix: upgrade the RN version in example apps to 0.75.4 * fix: pod install issue * fix: pod install issue * fix: pod install issue * fix: pod install issue * fix: pod install issue * feat: move react native image resizer native module to the SDK (#2751) * feat: move react native image resizer to the native package natively * fix: android and ios native module * fix: add StreamChatReactNative module for ios * fix: add StreamChatReactNative module for ios and android * fix: add StreamChatReactNative module for ios and android * docs: update docs for the removal of the image resizer package * fix: tests for audio controller * fix: tests for audio controller * fix: update sample app * fix: update sample app * fix: update sample app * fix: attachment picker image picker icon visibility as per dependency * fix: changes after merge * fix: lint issues * fix: revalidate pod cache * chore: revert cache revalidation * fix: sender and receiver message theme colors * fix: sender and receiver message theme colors (#2767) * fix: upgrade op-sqlite version to be compatible with latest react native version (#2761) * fix: upgrade op-sqlite version to be compatible with latest react native version * fix: lint issues * docs: add new architecture guide docs * revert: "docs: add new architecture guide docs" This reverts commit be16a66. * docs: fix migration guide * fix: add back set initial state * chore: backport the polls docs to v5 too * fix: add versioned sidebar update as well * chore: upgrade sample apps to RN 0.76.1 and added new arch docs (#2756) * chore: upgrade sample apps to RN 0.76.1 * docs: add new architecture guide * docs: add new architecture guide * fix: vale issues * chore: update the sample apps * fix: poll offline fixes (#2772) * fix: message disallowed indicator display (#2754) * fix: native image picker poll control (#2762) * fix: check for channel validity before consuming config (#2760) * fix: receiverMessageBackgroundColor hotfix (#2763) * fix: receiverMessageBackgroundColor hotfix * fix: tests * chore(release): 5.41.3 [skip ci] * chore(release): 1.31.4 [skip ci] * fix: theme for the message bubble and replies (#2766) * fix: theme for the message bubble and replies * fix: theme for the message bubble and replies * fix: add null coleasing operator * fix: poll edge cases (#2768) * fix: poll related edge cases with offline storage * feat: offline db for polls wip * fix: reconcile own_votes properly * fix: all underlying offline store issues with polls * fix: properly resolve own_votes and latest_answers * fix: remove faulty poll check * chore: remove commented out code * chore: remove log * fix: multiple answers bug and remove logs * chore: remove index as we have primary key * chore(release): 5.41.4 [skip ci] * chore(release): 1.31.5 [skip ci] * fix: errors during resolving conflicts and yarn.locks * fix: pod cache revalidation * fix: lint issues --------- Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Khushal Agarwal <khushal.agarwal987@gmail.com> * fix: revert cache revalidation and introduce dummy change in docs to trigger build * fix: resolve lint issues once again * fix: remove channel constants - isAdmin, isOwner and isModerator * fix: offline mode channel hydration issues * fix: remove channel constants - isAdmin, isOwner and isModerator (#2778) * fix: sender and receiver message theme colors * fix: remove channel constants - isAdmin, isOwner and isModerator * fix: faulty build for sample apps * fix: update yarn.lock files to fix build * fix: android modal size * fix: race conditions on db open and close * fix: move dropTables into check as well * fix: crash in some instances of useIsChannelMuted hook invocation * fix: properly use hook in channel preview * fix: edge cases and test * refactor: remove stale subscriber count logic and types refactor (#2782) * fix: regex state machine stack depth crash * fix: update test * fix: channel hook regressions * fix: expo media library permissions race conditions * feat: new message list pagination implementation * feat: enable moderation v2 on the sdk and sample apps * fix: listen to correct channel read events * fix: add FlatList default for Expo * fix: channel state initial data * fix: revert back the onStartReached change * fix: lint and tests * feat: add support for membership customization * fix: modify deployment workflow of SampleApp so that we get a release * fix: try bumping firebase version * fix: revert FB changes and CODE_SIGN_STYLE regression * fix: PROVISIONING_PROFILE_SPECIFIER specific val * fix: certificate distribution settings * fix: upgrade bottom sheet and fix reanimated errors in new arch (#2806) * fix: upgrade bottom sheet to get rid of warnings * fix: add sample app yarn.lock as well * fix: all remnants of reanimated errors * fix: update peer dependencies * fix: added tests for the hooks and message pagination * fix: podlock file for sample app * fix: channel.state break on going to background * fix: expo media library exceptions in new arch * chore: resolve conflicts from develop on v6 (#2813) * chore(release): 5.42.0 [skip ci] * chore(release): 1.31.6 [skip ci] * fix: android modal size (#2784) * fix: backport crash fix (#2787) * fix: crash in some instances of useIsChannelMuted hook invocation * fix: properly use hook in channel preview * fix: edge cases and test * chore(release): 5.42.1 [skip ci] * chore(release): 1.31.7 [skip ci] * fix: recursion depth on regex parse issue (#2790) * fix: channel hook regressions * fix: expo media library permissions race conditions * fix: listen to correct channel read events * chore(release): 5.42.2 [skip ci] * chore(release): 1.31.8 [skip ci] * feat: moderation v2 support (#2801) * feat: enable moderation v2 on the sdk and sample apps * chore: update yarn.lock files as well * feat: add support for membership customization (#2802) * feat: add support for membership customization * fix: lint issues * chore(release): 5.43.0 [skip ci] * chore(release): 1.32.0 [skip ci] * fix: channel.state break on going to background (#2809) * chore(release): 5.43.1 [skip ci] * chore(release): 1.32.1 [skip ci] * chore: resolve conflicts from develop on v6 --------- Co-authored-by: Ivan Sekovanikj <31964049+isekovanic@users.noreply.github.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Ivan Sekovanikj <ivan.sekovanikj@getstream.io> * fix: camera roll issues * fix: refactor photo resolution to native level * fix: expo media library * fix: properly resolve videos too * chore: remove console.log * chore: update yarn.lock files for example apps * fix: throttle logic for the copy message state * fix: bring back camera-roll to SampleApp * fix: also podfile.lock * fix: remove console.log * fix: issues with video preview * chore: remove console.log * feat: mark as unread and handle markRead in the SDK * chore: resolve conflicts from develop * feat: ai-bot integration poc (#2819) * feat: add StreamingMessageView to kick off ai feature * fix: issues with message view * feat: add AITypingIndicatorView * feat: make send message button react to ai state * fix: improve typewriter animation * fix: improvements in ui and typewriter * chore: add customizations to StreamingMessageView * fix: hook deps * chore: extract logic in hook * fix: custom events * fix: revert the type change in favor of changes in the LLC * feat: codeblock scrollable view * feat: table initial reimpl * feat: finish table impl * fix: horizontal scroll list performance issues * feat: add markdown parsing fixes, optimistic code capture and various improvements * fix: theme prop and theming in general * fix: remove edited lalbel for ai messages * fix: bug with stop streaming button and types * fix: colors in md rendering * fix: rename custom scrollview * chore: translations * fix: remove TODO * chore: extract indicator styles in theme * fix: safeguard if channel does not exist * fix: get rid of enum and introduce proper type * fix: allow only message overrides * chore: update event names as per the changes * fix: bump stream-chat-js version to v8.46.0 * fix: use channel method for sending events * fix: cover background mode case * fix: use type from LLC * chore: add jsdocs * fix: move check to checker fn * fix: add overrides for StreamingMessageView * chore: add override for stop streaming button * fix: message list improvements and channel first message mark unread improvements * fix: lint issues * chore: upgrade expo sample app to expo 52 * fix: remove unnecessary android and ios permissions * chore: update yarn.lock files * tests: add tests for the mark as unread feature * fix: unread message indicator on small message list * fix: date separator for small list * fix: improve scrolling fast scenario for scroll to target message * refactor: remove stale subscriber count logic and types refactor (#2832) * refactor: remove stale subscriber count logic and types refactor (#2782) * fix: lint issues * feat: Message list pagination implementation using hasPrev and hasNext (#2799) * refactor: remove stale subscriber count logic and types refactor (#2782) * feat: new message list pagination implementation * fix: channel state initial data * fix: revert back the onStartReached change * fix: lint and tests * fix: added tests for the hooks and message pagination * fix: podlock file for sample app * fix: throttle logic for the copy message state * fix: add back channel.deleted event * fix: useeffect deps * fix: add theme for the bottom sheet styles and message user reactions item (#2827) * fix: refactor some of the buttons * fix: refactor context usage * fix: solve final cyclical dep * fix: add corrected app.json * tests: add tests * fix: convert all poll buttons to pressables * fix: lint issues (that somehow passed without issues before) * chore: move add comment button to correct file * fix: move vote button to correct file too * fix: scroll to first unread message bug * fix: tests and lint issues * fix: image gallery issues (#2835) * fix: infinite image loading issue * fix: image gallery animations issue * fix: attachment picker unread floating indicator issue * fix: remove unnecessary logs * fix: add tests * fix: add improvements around read channel state * fix: image gallery header and footer safe area view (#2840) * fix: tests and lint issues * fix: tests and lint issues * chore: remove disable if frozen channel (#2841) * chore: write tests for disallowed sending messages (#2839) * chore: write tests for disallowed sending messages * fix: make test name more concise * chore: remove redundant assertion * chore: add test for the editing state as well * fix: only disable message input ui when capabilities change (#2836) * chore: remove disableIfFrozenChannel prop * fix: lint issues * fix: old arch image resizer native module spec file name fix (#2842) * fix: image gallery header and footer safe area view * fix: old arch image resizer native module spec file name fix * chore: fix all of the GH workflow stuff related to v6 in prep for releasing (#2843) * fix: move logic to component * fix: lint issues * fix: issues with handleSyncDb events * fix: dep update * fix: dep update * fiX: message list scroll settime outs * fix: lint issues * fix: broken tests --------- Co-authored-by: Ivan Sekovanikj <31964049+isekovanic@users.noreply.github.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Alexey Alter-Pesotskiy <alex@testableapple.com> Co-authored-by: Stream SDK Bot <60655709+Stream-SDK-Bot@users.noreply.github.com> Co-authored-by: Stream Bot <runner@fv-az1148-731.o3ts4yn1huletmfehy03vvfvxg.dx.internal.cloudapp.net> Co-authored-by: Santhosh Vaiyapuri <3846977+santhoshvai@users.noreply.github.com> Co-authored-by: Oliver Lazoroski <oliver.lazoroski@gmail.com> Co-authored-by: Ivan Sekovanikj <ivan.sekovanikj@getstream.io> Co-authored-by: Stream Bot <runner@fv-az1756-392.rxb2ubmju23uthz3oztawtjyeg.dx.internal.cloudapp.net>
1 parent 0de896d commit bba1505

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2138
-1201
lines changed

examples/SampleApp/ios/Podfile.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,7 @@ PODS:
21642164
- libwebp (~> 1.0)
21652165
- SDWebImage/Core (~> 5.10)
21662166
- SocketRocket (0.7.1)
2167-
- stream-chat-react-native (6.0.0):
2167+
- stream-chat-react-native (6.0.1):
21682168
- DoubleConversion
21692169
- glog
21702170
- hermes-engine
@@ -2474,7 +2474,7 @@ EXTERNAL SOURCES:
24742474

24752475
SPEC CHECKSUMS:
24762476
boost: 1dca942403ed9342f98334bf4c3621f011aa7946
2477-
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
2477+
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
24782478
FBLazyVector: 1bf99bb46c6af9a2712592e707347315f23947aa
24792479
Firebase: 7a56fe4f56b5ab81b86a6822f5b8f909ae6fc7e2
24802480
FirebaseAnalytics: 2f4a11eeb7a0e9c6fcf642d4e6aaca7fa4d38c28
@@ -2488,7 +2488,7 @@ SPEC CHECKSUMS:
24882488
FirebaseRemoteConfigInterop: e75e348953352a000331eb77caf01e424248e176
24892489
FirebaseSessions: b252b3f91a51186188882ea8e7e1730fc1eee391
24902490
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
2491-
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
2491+
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
24922492
GoogleAppMeasurement: ee5c2d2242816773fbf79e5b0563f5355ef1c315
24932493
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
24942494
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
@@ -2576,9 +2576,9 @@ SPEC CHECKSUMS:
25762576
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
25772577
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
25782578
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
2579-
stream-chat-react-native: 557a9b07b068fea9a1670302ca43f8589d884e33
2579+
stream-chat-react-native: 4b3bb162446ad9b25c745fc8083a2516d363d5eb
25802580
Yoga: 7548e4449365bf0ef60db4aefe58abff37fcabec
25812581

25822582
PODFILE CHECKSUM: 4f662370295f8f9cee909f1a4c59a614999a209d
25832583

2584-
COCOAPODS: 1.14.3
2584+
COCOAPODS: 1.16.2

examples/SampleApp/yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -7952,10 +7952,10 @@ statuses@~1.5.0:
79527952
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
79537953
integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==
79547954

7955-
stream-chat-react-native-core@6.0.0:
7956-
version "6.0.0"
7957-
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.0.0.tgz#77798c7082877572ef70223e1f799d22f0c78fe7"
7958-
integrity sha512-3cFao8iL2MjP7nhVRAl1vi526FbPlqUj4BHnYQ7sUNe+xb4z/HCEL6fKFh8kIfK5MEAacOQO4juPPQktoIf7zg==
7955+
stream-chat-react-native-core@6.0.1:
7956+
version "6.0.1"
7957+
resolved "https://registry.yarnpkg.com/stream-chat-react-native-core/-/stream-chat-react-native-core-6.0.1.tgz#a67f14685519cafa58466d28eee8f1edc9dbafcf"
7958+
integrity sha512-kyHgGn2PF+JTt7eEKdHMot9Nxzx+yecnlut9oyhi/IJbxOwpjIgB87+rdQXEI5o8SeNwQuAeV3VatxGaxl5Jbw==
79597959
dependencies:
79607960
"@gorhom/bottom-sheet" "^5.0.6"
79617961
dayjs "1.10.5"

package/src/components/Channel/Channel.tsx

+101-24
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
Channel as ChannelType,
1313
EventHandler,
1414
FormatMessageResponse,
15-
logChatPromiseExecution,
1615
MessageResponse,
1716
Reaction,
1817
SendMessageAPIResponse,
@@ -92,7 +91,7 @@ import {
9291
isImagePickerAvailable,
9392
} from '../../native';
9493
import * as dbApi from '../../store/apis';
95-
import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
94+
import { ChannelUnreadState, DefaultStreamChatGenerics, FileTypes } from '../../types/types';
9695
import { addReactionToLocalState } from '../../utils/addReactionToLocalState';
9796
import { compressedImageURI } from '../../utils/compressImage';
9897
import { DBSyncManager } from '../../utils/DBSyncManager';
@@ -179,6 +178,7 @@ import { ScrollToBottomButton as ScrollToBottomButtonDefault } from '../MessageL
179178
import { StickyHeader as StickyHeaderDefault } from '../MessageList/StickyHeader';
180179
import { TypingIndicator as TypingIndicatorDefault } from '../MessageList/TypingIndicator';
181180
import { TypingIndicatorContainer as TypingIndicatorContainerDefault } from '../MessageList/TypingIndicatorContainer';
181+
import { UnreadMessagesNotification as UnreadMessagesNotificationDefault } from '../MessageList/UnreadMessagesNotification';
182182
import { MessageActionList as MessageActionListDefault } from '../MessageMenu/MessageActionList';
183183
import { MessageActionListItem as MessageActionListItemDefault } from '../MessageMenu/MessageActionListItem';
184184
import { MessageMenu as MessageMenuDefault } from '../MessageMenu/MessageMenu';
@@ -188,6 +188,15 @@ import { MessageUserReactionsAvatar as MessageUserReactionsAvatarDefault } from
188188
import { MessageUserReactionsItem as MessageUserReactionsItemDefault } from '../MessageMenu/MessageUserReactionsItem';
189189
import { Reply as ReplyDefault } from '../Reply/Reply';
190190

191+
export type MarkReadFunctionOptions = {
192+
/**
193+
* Signal, whether the `channelUnreadUiState` should be updated.
194+
* By default, the local state update is prevented when the Channel component is mounted.
195+
* This is in order to keep the UI indicating the original unread state, when the user opens a channel.
196+
*/
197+
updateChannelUnreadState?: boolean;
198+
};
199+
191200
const styles = StyleSheet.create({
192201
selectChannel: { fontWeight: 'bold', padding: 16 },
193202
});
@@ -301,6 +310,7 @@ export type ChannelPropsWithContext<
301310
| 'handleDelete'
302311
| 'handleEdit'
303312
| 'handleFlag'
313+
| 'handleMarkUnread'
304314
| 'handleMute'
305315
| 'handlePinMessage'
306316
| 'handleReaction'
@@ -360,6 +370,7 @@ export type ChannelPropsWithContext<
360370
| 'VideoThumbnail'
361371
| 'PollContent'
362372
| 'hasCreatePoll'
373+
| 'UnreadMessagesNotification'
363374
| 'StreamingMessageView'
364375
>
365376
> &
@@ -384,7 +395,10 @@ export type ChannelPropsWithContext<
384395
* Overrides the Stream default mark channel read request (Advanced usage only)
385396
* @param channel Channel object
386397
*/
387-
doMarkReadRequest?: (channel: ChannelType<StreamChatGenerics>) => void;
398+
doMarkReadRequest?: (
399+
channel: ChannelType<StreamChatGenerics>,
400+
setChannelUnreadUiState?: (state: ChannelUnreadState) => void,
401+
) => void;
388402
/**
389403
* Overrides the Stream default send message request (Advanced usage only)
390404
* @param channelId
@@ -433,6 +447,10 @@ export type ChannelPropsWithContext<
433447
* Custom loading error indicator to override the Stream default
434448
*/
435449
LoadingErrorIndicator?: React.ComponentType<LoadingErrorProps>;
450+
/**
451+
* Boolean flag to enable/disable marking the channel as read on mount
452+
*/
453+
markReadOnMount?: boolean;
436454
maxMessageLength?: number;
437455
/**
438456
* Load the channel at a specified message instead of the most recent message.
@@ -529,6 +547,7 @@ const ChannelWithContext = <
529547
handleDelete,
530548
handleEdit,
531549
handleFlag,
550+
handleMarkUnread,
532551
handleMute,
533552
handlePinMessage,
534553
handleQuotedReply,
@@ -566,6 +585,7 @@ const ChannelWithContext = <
566585
loadingMore: loadingMoreProp,
567586
loadingMoreRecent: loadingMoreRecentProp,
568587
markdownRules,
588+
markReadOnMount = true,
569589
maxMessageLength: maxMessageLengthProp,
570590
maxNumberOfFiles = 10,
571591
maxTimeBetweenGroupedMessages,
@@ -647,6 +667,7 @@ const ChannelWithContext = <
647667
threadMessages,
648668
TypingIndicator = TypingIndicatorDefault,
649669
TypingIndicatorContainer = TypingIndicatorContainerDefault,
670+
UnreadMessagesNotification = UnreadMessagesNotificationDefault,
650671
UploadProgressIndicator = UploadProgressIndicatorDefault,
651672
UrlPreview = CardDefault,
652673
VideoThumbnail = VideoThumbnailDefault,
@@ -674,10 +695,13 @@ const ChannelWithContext = <
674695
const [thread, setThread] = useState<MessageType<StreamChatGenerics> | null>(threadProps || null);
675696
const [threadHasMore, setThreadHasMore] = useState(true);
676697
const [threadLoadingMore, setThreadLoadingMore] = useState(false);
698+
const [channelUnreadState, setChannelUnreadState] = useState<ChannelUnreadState | undefined>(
699+
undefined,
700+
);
677701

678702
const syncingChannelRef = useRef(false);
679703

680-
const { setTargetedMessage, targetedMessage } = useTargetedMessage();
704+
const { highlightedMessageId, setTargetedMessage, targetedMessage } = useTargetedMessage();
681705

682706
/**
683707
* This ref will hold the abort controllers for
@@ -692,6 +716,7 @@ const ChannelWithContext = <
692716
const {
693717
copyStateFromChannel,
694718
initStateFromChannel,
719+
setRead,
695720
setTyping,
696721
state: channelState,
697722
} = useChannelDataState<StreamChatGenerics>(channel);
@@ -754,6 +779,22 @@ const ChannelWithContext = <
754779
}
755780
}
756781

782+
if (event.type === 'notification.mark_unread') {
783+
setChannelUnreadState((prev) => {
784+
if (!(event.last_read_at && event.user)) return prev;
785+
return {
786+
first_unread_message_id: event.first_unread_message_id,
787+
last_read: new Date(event.last_read_at),
788+
last_read_message_id: event.last_read_message_id,
789+
unread_messages: event.unread_messages ?? 0,
790+
};
791+
});
792+
}
793+
794+
if (event.type === 'channel.truncated' && event.cid === channel.cid) {
795+
setChannelUnreadState(undefined);
796+
}
797+
757798
// only update channel state if the events are not the previously subscribed useEffect's subscription events
758799
if (channel && channel.initialized) {
759800
copyChannelState();
@@ -764,6 +805,8 @@ const ChannelWithContext = <
764805
useEffect(() => {
765806
let listener: ReturnType<typeof channel.on>;
766807
const initChannel = async () => {
808+
setLastRead(new Date());
809+
const unreadCount = channel.countUnread();
767810
if (!channel || !shouldSyncChannel || channel.offlineMode) return;
768811
let errored = false;
769812

@@ -782,14 +825,32 @@ const ChannelWithContext = <
782825
loadInitialMessagesStateFromChannel(channel, channel.state.messagePagination.hasPrev);
783826
}
784827

828+
if (client.user?.id && channel.state.read[client.user.id]) {
829+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
830+
const { user, ...ownReadState } = channel.state.read[client.user.id];
831+
setChannelUnreadState(ownReadState);
832+
}
833+
785834
if (messageId) {
786835
await loadChannelAroundMessage({ messageId, setTargetedMessage });
787836
} else if (
788837
initialScrollToFirstUnreadMessage &&
789-
channel.countUnread() > scrollToFirstUnreadThreshold
838+
client.user &&
839+
unreadCount > scrollToFirstUnreadThreshold
790840
) {
791-
await loadChannelAtFirstUnreadMessage({ setTargetedMessage });
841+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
842+
const { user, ...ownReadState } = channel.state.read[client.user.id];
843+
await loadChannelAtFirstUnreadMessage({
844+
channelUnreadState: ownReadState,
845+
setChannelUnreadState,
846+
setTargetedMessage,
847+
});
848+
}
849+
850+
if (unreadCount > 0 && markReadOnMount) {
851+
await markRead({ updateChannelUnreadState: false });
792852
}
853+
793854
listener = channel.on(handleEvent);
794855
};
795856

@@ -819,12 +880,12 @@ const ChannelWithContext = <
819880
*/
820881
useEffect(() => {
821882
const handleEvent: EventHandler<StreamChatGenerics> = (event) => {
822-
if (channel.cid === event.cid) copyChannelState();
883+
if (channel.cid === event.cid) setRead(channel);
823884
};
824885

825886
const { unsubscribe } = client.on('notification.mark_read', handleEvent);
826887
return unsubscribe;
827-
}, [channel.cid, client, copyChannelState]);
888+
}, [channel, client, setRead]);
828889

829890
const threadPropsExists = !!threadProps;
830891

@@ -858,23 +919,33 @@ const ChannelWithContext = <
858919
/**
859920
* CHANNEL METHODS
860921
*/
861-
const markRead: ChannelContextValue<StreamChatGenerics>['markRead'] = useRef(
862-
throttle(
863-
() => {
864-
if (!channel || channel?.disconnected || !clientChannelConfig?.read_events) {
865-
return;
866-
}
922+
const markRead: ChannelContextValue<StreamChatGenerics>['markRead'] = throttle(
923+
async (options?: MarkReadFunctionOptions) => {
924+
const { updateChannelUnreadState = true } = options ?? {};
925+
if (!channel || channel?.disconnected || !clientChannelConfig?.read_events) {
926+
return;
927+
}
867928

868-
if (doMarkReadRequest) {
869-
doMarkReadRequest(channel);
870-
} else {
871-
logChatPromiseExecution(channel.markRead(), 'mark read');
929+
if (doMarkReadRequest) {
930+
doMarkReadRequest(channel, updateChannelUnreadState ? setChannelUnreadState : undefined);
931+
} else {
932+
try {
933+
const response = await channel.markRead();
934+
if (updateChannelUnreadState && response && lastRead) {
935+
setChannelUnreadState({
936+
last_read: lastRead,
937+
last_read_message_id: response?.event.last_read_message_id,
938+
unread_messages: 0,
939+
});
940+
}
941+
} catch (err) {
942+
console.log('Error marking channel as read:', err);
872943
}
873-
},
874-
defaultThrottleInterval,
875-
throttleOptions,
876-
),
877-
).current;
944+
}
945+
},
946+
defaultThrottleInterval,
947+
throttleOptions,
948+
);
878949

879950
const reloadThread = async () => {
880951
if (!channel || !thread?.id) return;
@@ -1596,8 +1667,9 @@ const ChannelWithContext = <
15961667
overrideCapabilities: overrideOwnCapabilities,
15971668
});
15981669

1599-
const channelContext = useCreateChannelContext({
1670+
const channelContext = useCreateChannelContext<StreamChatGenerics>({
16001671
channel,
1672+
channelUnreadState,
16011673
disabled: !!channel?.data?.frozen,
16021674
EmptyStateIndicator,
16031675
enableMessageGroupingByUser,
@@ -1608,9 +1680,11 @@ const ChannelWithContext = <
16081680
!!(clientChannelConfig?.commands || [])?.some((command) => command.name === 'giphy'),
16091681
hideDateSeparators,
16101682
hideStickyDateHeader,
1683+
highlightedMessageId,
16111684
isChannelActive: shouldSyncChannel,
16121685
lastRead,
16131686
loadChannelAroundMessage,
1687+
loadChannelAtFirstUnreadMessage,
16141688
loading: channelMessagesState.loading,
16151689
LoadingIndicator,
16161690
markRead,
@@ -1620,6 +1694,7 @@ const ChannelWithContext = <
16201694
read: channelState.read ?? {},
16211695
reloadChannel,
16221696
scrollToFirstUnreadThreshold,
1697+
setChannelUnreadState,
16231698
setLastRead,
16241699
setTargetedMessage,
16251700
StickyHeader,
@@ -1748,6 +1823,7 @@ const ChannelWithContext = <
17481823
handleDelete,
17491824
handleEdit,
17501825
handleFlag,
1826+
handleMarkUnread,
17511827
handleMute,
17521828
handlePinMessage,
17531829
handleQuotedReply,
@@ -1815,6 +1891,7 @@ const ChannelWithContext = <
18151891
targetedMessage,
18161892
TypingIndicator,
18171893
TypingIndicatorContainer,
1894+
UnreadMessagesNotification,
18181895
updateMessage,
18191896
UrlPreview,
18201897
VideoThumbnail,

0 commit comments

Comments
 (0)