-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> 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 <[email protected]> * lint fixes * fix lint issues * fix locks * move to ruby 3.1 and greater --------- Co-authored-by: Oliver Lazoroski <[email protected]> * 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 <[email protected]> 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 <[email protected]> Co-authored-by: semantic-release-bot <[email protected]> Co-authored-by: Alexey Alter-Pesotskiy <[email protected]> Co-authored-by: Stream SDK Bot <[email protected]> Co-authored-by: Stream Bot <runner@fv-az1148-731.o3ts4yn1huletmfehy03vvfvxg.dx.internal.cloudapp.net> Co-authored-by: Santhosh Vaiyapuri <[email protected]> Co-authored-by: Oliver Lazoroski <[email protected]> Co-authored-by: Ivan Sekovanikj <[email protected]> Co-authored-by: Stream Bot <runner@fv-az1756-392.rxb2ubmju23uthz3oztawtjyeg.dx.internal.cloudapp.net>
- Loading branch information
1 parent
36f2fe1
commit 8207356
Showing
111 changed files
with
4,678 additions
and
2,086 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v18 | ||
v20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
[![NPM](https://img.shields.io/npm/v/stream-chat-react-native.svg)](https://www.npmjs.com/package/stream-chat-react-native) | ||
[![Build Status](https://github.com/GetStream/stream-chat-react-native/actions/workflows/release.yml/badge.svg)](https://github.com/GetStream/stream-chat-react-native/actions) | ||
[![Component Reference](https://img.shields.io/badge/docs-component%20reference-blue.svg)](https://getstream.io/chat/docs/sdk/reactnative) | ||
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-439%20KB-blue) | ||
![JS Bundle Size](https://img.shields.io/badge/js_bundle_size-442%20KB-blue) | ||
|
||
<img align="right" src="https://getstream.imgix.net/images/ios-chat-tutorial/[email protected]?auto=format,enhance" width="50%" /> | ||
|
||
|
Binary file added
BIN
+36.7 KB
docusaurus/docs/reactnative/assets/guides/blocking-users/blocked-users-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+689 KB
docusaurus/docs/reactnative/assets/guides/deeplinking/xcode-info-url-types.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+572 KB
...urus/docs/reactnative/assets/guides/deeplinking/xcode-signing-capabilitites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+382 KB
docusaurus/docs/reactnative/assets/guides/live-location-sharing/chat-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+769 KB
docusaurus/docs/reactnative/assets/guides/live-location-sharing/detail-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
...urus/docs/reactnative/common-content/ui-components/channel/props/handle_ban.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Function called when the _Ban User_ action is invoked from message actions list. | ||
This function does not override the default behavior of the _Ban User_ action. | ||
Please refer to [the guide on customizing message actions](../../../../guides/custom-message-actions.mdx) for details. | ||
|
||
| Type | | ||
| -------- | | ||
| function | | ||
|
||
| Parameter | Description | | ||
| --------- | ------------------------------- | | ||
| message | message the action is called on | |
11 changes: 7 additions & 4 deletions
11
...us/docs/reactnative/common-content/ui-components/channel/props/handle_block.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
:::note | ||
This is deprecated. Please use `handleBan` instead. | ||
::: | ||
|
||
Function called when the _Block User_ action is invoked from message actions list. | ||
This function does not override the default behavior of the _Block User_ action. | ||
Please refer to [the guide on customizing message actions](../../../../guides/custom-message-actions.mdx) for details. | ||
|
||
| Type | | ||
| -------- | | ||
| function | | ||
|
||
| Type | | ||
| --------- | ------------------------------- | | ||
| function | | ||
| Parameter | Description | | ||
| --------- | ------------------------------- | | ||
| message | message the action is called on | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
--- | ||
id: blocking-users | ||
title: Blocking Users | ||
--- | ||
|
||
## Introduction | ||
|
||
Blocking users is an essential feature in a chat app because it enhances user safety and experience. It allows individuals to protect themselves from harassment, spam, and unwanted interactions. By giving users control over their interactions, it helps maintain privacy, reduces the risk of cyber-bullying, and promotes a respectful community atmosphere. | ||
|
||
As a result, some app stores require this functionality as part of their review process. | ||
|
||
## Stream Chat | ||
|
||
The Stream Chat SDK provides a way for blocking and unblocking users, as well as listing all of the blocked users. | ||
|
||
When you block a user, you won’t receive any direct messages from that user anymore. However, if you share a group with other participants, you will still receive messages from the blocked user. | ||
|
||
In this cookbook, we will see how to implement this feature in your chat apps, using the Stream Chat SDK. | ||
|
||
## Low Level Client support | ||
|
||
The low-level client provides the following methods related to user blocking. | ||
|
||
### Blocking a user | ||
|
||
In order to block a user, you need to use the `blockUser` method of the client instance. This method takes the user id of the user you wish to block. | ||
|
||
```tsx | ||
import { StreamChat } from 'stream-chat'; | ||
const chatClient = StreamChat.getInstance('your api key'); | ||
|
||
// Note this has to be done after the client connection(`client.connectUser`) is established. | ||
const blockUser = async (userId: string) => { | ||
try { | ||
await chatClient.blockUser(userId); | ||
} catch (err) { | ||
console.log('Error blocking user:', err); | ||
} | ||
}; | ||
``` | ||
|
||
### Unblocking a user | ||
|
||
Similarly, to unblock a blocked user, you need to use the `unBlockUser` method of the client instance. This method takes the user id of the user you wish to unblock. | ||
|
||
```tsx | ||
import { StreamChat } from 'stream-chat'; | ||
const chatClient = StreamChat.getInstance('your api key'); | ||
|
||
// Note this has to be done after the client connection(`client.connectUser`) is established. | ||
const unBlockUser = async (userId: string) => { | ||
try { | ||
await chatClient.unBlockUser(userId); | ||
} catch (err) { | ||
console.log('Error UnBlocking user:', err); | ||
} | ||
}; | ||
``` | ||
|
||
### Listing Blocked Users | ||
|
||
To list all the blocked users, you can use the `getBlockedUsers` method of the client instance. | ||
|
||
```tsx | ||
const chatClient = StreamChat.getInstance('your api key'); | ||
|
||
// Note this has to be done after the client connection(`client.connectUser`) is established. | ||
const getBlockedUsers = async () => { | ||
try { | ||
const users = await chatClient.getBlockedUsers(); | ||
setBlockedUsers(users.blocks); | ||
} catch (error) { | ||
console.log('Error getting blocked users:', error); | ||
} | ||
}; | ||
``` | ||
|
||
## Message Actions | ||
|
||
You can use the logic above to create your own custom message actions that will involve user blocking. | ||
|
||
This can be done by using the `messageActions` prop of the `Channel` component. You can follow the guide [here](../guides/custom-message-actions.mdx). | ||
|
||
```tsx | ||
import { Channel, messageActions } from 'stream-chat-react-native'; | ||
|
||
const App = () => { | ||
return ( | ||
<Channel | ||
channel={channel} | ||
messageActions={params => { | ||
const { dismissOverlay, message } = params; | ||
const actions = messageActions({ ...params }); | ||
if (actions) { | ||
actions.push({ | ||
action: async () => { | ||
try { | ||
await chatClient.blockUser(message.user?.id || ''); | ||
dismissOverlay(); | ||
} catch (error) { | ||
console.log('Error blocking user:', error); | ||
} | ||
}, | ||
actionType: 'block-user', | ||
title: 'Block User', | ||
}); | ||
return actions; | ||
} else { | ||
return []; | ||
} | ||
}} | ||
> | ||
{/* Other components here */} | ||
</Channel> | ||
); | ||
}; | ||
``` | ||
|
||
## Displaying Blocked users | ||
|
||
Next, let’s see how we can build a custom UI that will show the list of blocked users. This will allow easier overview for the users about who they blocked, as well as provide an easy way to unblock them if needed. | ||
|
||
![Blocked Users](../assets/guides/blocking-users/blocked-users-list.png) | ||
|
||
```tsx | ||
import { useEffect, useState } from 'react'; | ||
import { Image, StyleSheet, Text, View } from 'react-native'; | ||
import { BlockedUserDetails, StreamChat } from 'stream-chat'; | ||
|
||
const chatClient = StreamChat.getInstance('your api key'); | ||
|
||
const BlockedUsers = () => { | ||
const [blockedUsers, setBlockedUsers] = useState<BlockedUserDetails[]>([]); | ||
|
||
useEffect(() => { | ||
const getBlockedUsers = async () => { | ||
try { | ||
const users = await chatClient.getBlockedUsers(); | ||
setBlockedUsers(users.blocks); | ||
} catch (error) { | ||
console.log('Error getting blocked users:', error); | ||
} | ||
}; | ||
|
||
getBlockedUsers(); | ||
}, []); | ||
|
||
const unBlockUser = async (userId: string) => { | ||
try { | ||
await chatClient.unBlockUser(userId); | ||
const filteredUsers = blockedUsers.filter(user => user.blocked_user_id !== userId); | ||
setBlockedUsers(filteredUsers); | ||
} catch (err) { | ||
console.log('Error UnBlocking user:', err); | ||
} | ||
}; | ||
|
||
return ( | ||
<View> | ||
{blockedUsers.map((blockedUser: BlockedUserDetails) => ( | ||
<Pressable | ||
key={blockedUser.blocked_user_id} | ||
onPress={() => { | ||
unBlockUser(blockedUser.blocked_user_id); | ||
}} | ||
style={styles.container} | ||
> | ||
<Image source={{ uri: blockedUser.blocked_user.image as string }} style={styles.image} /> | ||
<Text style={styles.name}>{blockedUser.blocked_user.name}</Text> | ||
</Pressable> | ||
))} | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flexDirection: 'row', | ||
padding: 16, | ||
alignItems: 'center', | ||
}, | ||
image: { | ||
height: 80, | ||
width: 80, | ||
borderRadius: 40, | ||
}, | ||
name: { | ||
fontSize: 16, | ||
fontWeight: 'bold', | ||
marginLeft: 16, | ||
}, | ||
}); | ||
``` | ||
|
||
There’s nothing special in this view, it just shows the blocked users in a list, and exposes a delete action, which will remove the blocked user from the list. | ||
|
||
## Summary | ||
|
||
In this cookbook we have seen the capabilities of the Stream Chat SDK for blocking users. We have also seen how to add message actions to block and unblock users, as well as a custom UI for displaying the blocked users. | ||
|
||
It is recommended to use these actions, in order to avoid issues during app store reviews, especially on the Apple platforms. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.