stream-chat-react-native-core 9.0.0-beta.14 → 9.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +62 -17
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +17 -2
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js +5 -4
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js +26 -31
- package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +65 -36
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js.map +1 -1
- package/lib/commonjs/components/Message/utils/messageActions.js +1 -1
- package/lib/commonjs/components/Message/utils/messageActions.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +3 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js +4 -2
- package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/commonjs/icons/index.js +12 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/store/OfflineDB.js +1 -0
- package/lib/commonjs/store/OfflineDB.js.map +1 -1
- package/lib/commonjs/store/apis/index.js +11 -0
- package/lib/commonjs/store/apis/index.js.map +1 -1
- package/lib/commonjs/store/apis/updatePendingTask.js +34 -0
- package/lib/commonjs/store/apis/updatePendingTask.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +62 -17
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useChannelActionItems.js +1 -1
- package/lib/module/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +17 -2
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js +5 -4
- package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js +26 -31
- package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +65 -36
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.js.map +1 -1
- package/lib/module/components/Message/utils/messageActions.js +1 -1
- package/lib/module/components/Message/utils/messageActions.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js +3 -1
- package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
- package/lib/module/components/UIComponents/BottomSheetModal.js +4 -2
- package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
- package/lib/module/icons/index.js +12 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/store/OfflineDB.js +1 -0
- package/lib/module/store/OfflineDB.js.map +1 -1
- package/lib/module/store/apis/index.js +11 -0
- package/lib/module/store/apis/index.js.map +1 -1
- package/lib/module/store/apis/updatePendingTask.js +34 -0
- package/lib/module/store/apis/updatePendingTask.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelDetailsBottomSheet.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewMessage.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts.map +1 -1
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts +3 -2
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts.map +1 -1
- package/lib/typescript/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageUserReactions.d.ts.map +1 -1
- package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
- package/lib/typescript/icons/index.d.ts +1 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/store/OfflineDB.d.ts +1 -0
- package/lib/typescript/store/OfflineDB.d.ts.map +1 -1
- package/lib/typescript/store/apis/index.d.ts +1 -0
- package/lib/typescript/store/apis/index.d.ts.map +1 -1
- package/lib/typescript/store/apis/updatePendingTask.d.ts +3 -0
- package/lib/typescript/store/apis/updatePendingTask.d.ts.map +1 -0
- package/lib/typescript/store/mappers/mapTaskToStorable.d.ts +9 -0
- package/lib/typescript/store/mappers/mapTaskToStorable.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/offline-support/optimistic-update.js +225 -0
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +2 -2
- package/src/components/AttachmentPicker/components/AttachmentTypePickerButton.tsx +2 -2
- package/src/components/Channel/Channel.tsx +50 -4
- package/src/components/ChannelList/hooks/__tests__/useChannelActionItems.test.tsx +2 -2
- package/src/components/ChannelList/hooks/useChannelActionItems.tsx +1 -1
- package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +15 -1
- package/src/components/ChannelPreview/ChannelPreviewMessage.tsx +7 -2
- package/src/components/ChannelPreview/ChannelSwipableWrapper.tsx +26 -29
- package/src/components/ChannelPreview/__tests__/ChannelSwipableWrapper.test.tsx +201 -0
- package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx +43 -25
- package/src/components/KeyboardCompatibleView/KeyboardControllerAvoidingView.tsx +1 -7
- package/src/components/Message/utils/messageActions.ts +1 -1
- package/src/components/MessageMenu/MessageUserReactions.tsx +3 -1
- package/src/components/MessageMenu/__tests__/MessageUserReactions.test.tsx +9 -2
- package/src/components/UIComponents/BottomSheetModal.tsx +4 -2
- package/src/icons/index.ts +1 -0
- package/src/store/OfflineDB.ts +2 -0
- package/src/store/apis/__tests__/updatePendingTask.test.ts +66 -0
- package/src/store/apis/index.ts +1 -0
- package/src/store/apis/updatePendingTask.ts +24 -0
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ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,MAAM,QAAQ,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC"}
|
|
@@ -69,6 +69,7 @@ export declare class OfflineDB extends AbstractOfflineDB {
|
|
|
69
69
|
limit?: number;
|
|
70
70
|
}) => Promise<import("stream-chat").ReactionResponse[] | null>;
|
|
71
71
|
addPendingTask: (task: import("stream-chat").PendingTask) => Promise<() => Promise<void>>;
|
|
72
|
+
updatePendingTask: ({ id, task }: import("stream-chat").DBUpdatePendingTaskType) => Promise<import("./types").PreparedQueries[]>;
|
|
72
73
|
deletePendingTask: ({ id }: {
|
|
73
74
|
id: number;
|
|
74
75
|
}) => Promise<import("./types").PreparedQueries[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OfflineDB.d.ts","sourceRoot":"","sources":["../../../src/store/OfflineDB.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,aAAa,CAAC;AAKrB,qBAAa,SAAU,SAAQ,iBAAiB;gBAClC,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE;IAI9C,kBAAkB;;eAJlB,CAAF;eAA4B,CAAA;YAAiB,CAAC;uDAIA;IAE5C,cAAc;;eAG6C,CAAA;2BACzD,CAAF;uDAJoC;IAGpC,oBAAoB,GAAI,mCAAmC,0BAA0B,kDACR;IAG7E,iBAAiB,GAAI,kCAAkC,uBAAuB,kDACL;IAEzE,UAAU;;eAjBgC,CAAC;uDAiBf;IAE5B,WAAW;;eAVwB,CAAC;uDAUN;IAE9B,QAAQ;;;iBAhBe,CAAC;8DAgBA;IAExB,WAAW;;iBA7BW,CAAC;eACX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AAW;;iBA7BW,CAAC;eACX,CAAC;uDA4BiB;IAE9B,iBAAiB;;eAzBc,CAAC;uDAyBU;IAE1C,WAAW;;;eAtBF,CAAC;uDAsBoB;IAE9B,cAAc;;eAlBH,CAAC;uDAkBwB;IAEpC,aAAa;;;eA1BwB,CAAC;uDA0BJ;IAElC,aAAa;;eAvBgD,CAAC;uDAuB5B;IAGlC,WAAW,GAAI,kBAAkB,iBAAiB,2EACa;IAG/D,mBAAmB,GAAI,2BAA2B,yBAAyB,kFACF;IAEzE,iBAAiB,0BAAwB;IAGzC,eAAe,GAAI,YAAY,qBAAqB,iCACH;IAEjD,cAAc,GAAI,YAAY,oBAAoB,kEACF;IAEhD,YAAY;;eAzCkB,CAAC;YAAuC,CAAC;aAE1D,CAAC;mEAuC+B;IAE7C,cAAc,4EAAsB;IAEpC,iBAAiB,gHAAyB;IAE1C,iBAAiB;;uDAAyB;IAE1C,cAAc;;eA1DJ,CAAC;eAGwB,CAAC;uDAuDA;IAEpC,YAAY;;;eAhEe,CAAA;uDAgEK;IAEhC,aAAa;;eAtEJ,CAAC;uDAsEwB;IAElC,wBAAwB;;oBAzExB,CAAF;eAAmB,CAAC;mDAyEsC;IAExD,gBAAgB;;eAzDoC,CAAA;uDAyDZ;IAExC,iBAAiB;;eA5EjB,CAAD;kDA4EuC;IAEtC,iBAAiB,6HAAyB;IAE1C,eAAe;iBA5ER,CAAC;uDA4E8B;IAEtC,cAAc;;;eAjEgB,CAAC;uDAiEK;IAEpC,cAAc;;;eArEF,CAAC;uDAqEuB;IAEpC,aAAa;;2BAAqB;IAElC,OAAO,sBAAwB;IAE/B,eAAe,uEAAgC;IAE/C,YAAY,yBAAmC;CAChD"}
|
|
@@ -13,6 +13,7 @@ export * from './getLastSyncedAt';
|
|
|
13
13
|
export * from './getMembers';
|
|
14
14
|
export * from './getReads';
|
|
15
15
|
export * from './updateMessage';
|
|
16
|
+
export * from './updatePendingTask';
|
|
16
17
|
export * from './updateReaction';
|
|
17
18
|
export * from './insertReaction';
|
|
18
19
|
export * from './deleteReaction';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePendingTask.d.ts","sourceRoot":"","sources":["../../../../src/store/apis/updatePendingTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAM3D,eAAO,MAAM,iBAAiB,GAAU,cAAc,uBAAuB,kDAiB5E,CAAC"}
|
|
@@ -8,6 +8,15 @@ export declare const mapTaskToStorable: (task: PendingTask) => {
|
|
|
8
8
|
id?: number;
|
|
9
9
|
threadId?: string;
|
|
10
10
|
type: import("stream-chat").PendingTaskTypes["sendReaction"];
|
|
11
|
+
} | {
|
|
12
|
+
createdAt: string;
|
|
13
|
+
payload: string;
|
|
14
|
+
channelId?: string;
|
|
15
|
+
channelType?: string;
|
|
16
|
+
messageId?: string;
|
|
17
|
+
id?: number;
|
|
18
|
+
threadId?: string;
|
|
19
|
+
type: import("stream-chat").PendingTaskTypes["updateMessage"];
|
|
11
20
|
} | {
|
|
12
21
|
createdAt: string;
|
|
13
22
|
payload: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapTaskToStorable.d.ts","sourceRoot":"","sources":["../../../../src/store/mappers/mapTaskToStorable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,iBAAiB,GAAI,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"mapTaskToStorable.d.ts","sourceRoot":"","sources":["../../../../src/store/mappers/mapTaskToStorable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,iBAAiB,GAAI,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "9.0.0-beta.
|
|
4
|
+
"version": "9.0.0-beta.16",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"path": "0.12.7",
|
|
85
85
|
"react-native-markdown-package": "1.8.2",
|
|
86
86
|
"react-native-url-polyfill": "^2.0.0",
|
|
87
|
-
"stream-chat": "^9.
|
|
87
|
+
"stream-chat": "^9.40.0",
|
|
88
88
|
"use-sync-external-store": "^1.5.0"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
@@ -15,6 +15,7 @@ import { getOrCreateChannelApi } from '../../mock-builders/api/getOrCreateChanne
|
|
|
15
15
|
import { sendMessageApi } from '../../mock-builders/api/sendMessage';
|
|
16
16
|
import { sendReactionApi } from '../../mock-builders/api/sendReaction';
|
|
17
17
|
import { useMockedApis } from '../../mock-builders/api/useMockedApis';
|
|
18
|
+
import { generateFileReference } from '../../mock-builders/attachments';
|
|
18
19
|
import dispatchConnectionChangedEvent from '../../mock-builders/event/connectionChanged';
|
|
19
20
|
import { generateChannelResponse } from '../../mock-builders/generator/channel';
|
|
20
21
|
import { generateMember } from '../../mock-builders/generator/member';
|
|
@@ -25,6 +26,7 @@ import { getTestClientWithUser } from '../../mock-builders/mock';
|
|
|
25
26
|
import { upsertChannels } from '../../store/apis';
|
|
26
27
|
import { SqliteClient } from '../../store/SqliteClient';
|
|
27
28
|
import { BetterSqlite } from '../../test-utils/BetterSqlite';
|
|
29
|
+
import { MessageStatusTypes } from '../../utils/utils';
|
|
28
30
|
|
|
29
31
|
test('Workaround to allow exporting tests', () => expect(true).toBe(true));
|
|
30
32
|
|
|
@@ -397,6 +399,229 @@ export const OptimisticUpdates = () => {
|
|
|
397
399
|
});
|
|
398
400
|
});
|
|
399
401
|
|
|
402
|
+
describe('edit message', () => {
|
|
403
|
+
it('should keep the optimistic edit in state and DB if the LLC queues the edit', async () => {
|
|
404
|
+
const message = channel.state.messages[0];
|
|
405
|
+
const editedText = 'edited while offline';
|
|
406
|
+
|
|
407
|
+
render(
|
|
408
|
+
<Chat client={chatClient} enableOfflineSupport>
|
|
409
|
+
<Channel
|
|
410
|
+
channel={channel}
|
|
411
|
+
doUpdateMessageRequest={async (_channelId, localMessage, options) => {
|
|
412
|
+
await chatClient.offlineDb.addPendingTask({
|
|
413
|
+
channelId: channel.id,
|
|
414
|
+
channelType: channel.type,
|
|
415
|
+
messageId: message.id,
|
|
416
|
+
payload: [localMessage, undefined, options],
|
|
417
|
+
type: 'update-message',
|
|
418
|
+
});
|
|
419
|
+
return {
|
|
420
|
+
message: {
|
|
421
|
+
...localMessage,
|
|
422
|
+
message_text_updated_at: new Date(),
|
|
423
|
+
updated_at: new Date(),
|
|
424
|
+
},
|
|
425
|
+
};
|
|
426
|
+
}}
|
|
427
|
+
>
|
|
428
|
+
<CallbackEffectWithContext
|
|
429
|
+
callback={async ({ editMessage }) => {
|
|
430
|
+
await editMessage({
|
|
431
|
+
localMessage: {
|
|
432
|
+
...message,
|
|
433
|
+
cid: channel.cid,
|
|
434
|
+
text: editedText,
|
|
435
|
+
},
|
|
436
|
+
options: {},
|
|
437
|
+
});
|
|
438
|
+
}}
|
|
439
|
+
context={MessageInputContext}
|
|
440
|
+
>
|
|
441
|
+
<View testID='children' />
|
|
442
|
+
</CallbackEffectWithContext>
|
|
443
|
+
</Channel>
|
|
444
|
+
</Chat>,
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
await waitFor(() => expect(screen.getByTestId('children')).toBeTruthy());
|
|
448
|
+
|
|
449
|
+
await waitFor(async () => {
|
|
450
|
+
const updatedMessage = channel.state.findMessage(message.id);
|
|
451
|
+
const pendingTasksRows = await BetterSqlite.selectFromTable('pendingTasks');
|
|
452
|
+
const dbMessages = await BetterSqlite.selectFromTable('messages');
|
|
453
|
+
const dbMessage = dbMessages.find((row) => row.id === message.id);
|
|
454
|
+
|
|
455
|
+
expect(updatedMessage.text).toBe(editedText);
|
|
456
|
+
expect(updatedMessage.message_text_updated_at).toBeTruthy();
|
|
457
|
+
expect(pendingTasksRows).toHaveLength(1);
|
|
458
|
+
expect(pendingTasksRows[0].type).toBe('update-message');
|
|
459
|
+
expect(dbMessage.text).toBe(editedText);
|
|
460
|
+
expect(dbMessage.messageTextUpdatedAt).toBeTruthy();
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
it('should keep the optimistic edit if the request fails', async () => {
|
|
465
|
+
const message = channel.state.messages[0];
|
|
466
|
+
const editedText = 'should stay optimistic';
|
|
467
|
+
|
|
468
|
+
render(
|
|
469
|
+
<Chat client={chatClient} enableOfflineSupport>
|
|
470
|
+
<Channel
|
|
471
|
+
channel={channel}
|
|
472
|
+
doUpdateMessageRequest={() => {
|
|
473
|
+
throw new Error('validation');
|
|
474
|
+
}}
|
|
475
|
+
>
|
|
476
|
+
<CallbackEffectWithContext
|
|
477
|
+
callback={async ({ editMessage }) => {
|
|
478
|
+
try {
|
|
479
|
+
await editMessage({
|
|
480
|
+
localMessage: {
|
|
481
|
+
...message,
|
|
482
|
+
cid: channel.cid,
|
|
483
|
+
text: editedText,
|
|
484
|
+
},
|
|
485
|
+
options: {},
|
|
486
|
+
});
|
|
487
|
+
} catch (e) {
|
|
488
|
+
// do nothing
|
|
489
|
+
}
|
|
490
|
+
}}
|
|
491
|
+
context={MessageInputContext}
|
|
492
|
+
>
|
|
493
|
+
<View testID='children' />
|
|
494
|
+
</CallbackEffectWithContext>
|
|
495
|
+
</Channel>
|
|
496
|
+
</Chat>,
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
await waitFor(() => expect(screen.getByTestId('children')).toBeTruthy());
|
|
500
|
+
|
|
501
|
+
await waitFor(async () => {
|
|
502
|
+
const updatedMessage = channel.state.findMessage(message.id);
|
|
503
|
+
const pendingTasksRows = await BetterSqlite.selectFromTable('pendingTasks');
|
|
504
|
+
const dbMessages = await BetterSqlite.selectFromTable('messages');
|
|
505
|
+
const dbMessage = dbMessages.find((row) => row.id === message.id);
|
|
506
|
+
|
|
507
|
+
expect(updatedMessage.text).toBe(editedText);
|
|
508
|
+
expect(pendingTasksRows).toHaveLength(0);
|
|
509
|
+
expect(dbMessage.text).toBe(editedText);
|
|
510
|
+
});
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
it('should not set message_text_updated_at during optimistic edit of a failed message', async () => {
|
|
514
|
+
const message = channel.state.messages[0];
|
|
515
|
+
const optimisticStateSpy = jest.fn();
|
|
516
|
+
|
|
517
|
+
render(
|
|
518
|
+
<Chat client={chatClient} enableOfflineSupport>
|
|
519
|
+
<Channel
|
|
520
|
+
channel={channel}
|
|
521
|
+
doUpdateMessageRequest={() => {
|
|
522
|
+
const optimisticMessage = channel.state.findMessage(message.id);
|
|
523
|
+
optimisticStateSpy(optimisticMessage);
|
|
524
|
+
|
|
525
|
+
return {
|
|
526
|
+
message: {
|
|
527
|
+
...optimisticMessage,
|
|
528
|
+
},
|
|
529
|
+
};
|
|
530
|
+
}}
|
|
531
|
+
>
|
|
532
|
+
<CallbackEffectWithContext
|
|
533
|
+
callback={async ({ editMessage }) => {
|
|
534
|
+
await editMessage({
|
|
535
|
+
localMessage: {
|
|
536
|
+
...message,
|
|
537
|
+
cid: channel.cid,
|
|
538
|
+
status: MessageStatusTypes.FAILED,
|
|
539
|
+
text: 'edited failed message',
|
|
540
|
+
},
|
|
541
|
+
options: {},
|
|
542
|
+
});
|
|
543
|
+
}}
|
|
544
|
+
context={MessageInputContext}
|
|
545
|
+
>
|
|
546
|
+
<View testID='children' />
|
|
547
|
+
</CallbackEffectWithContext>
|
|
548
|
+
</Channel>
|
|
549
|
+
</Chat>,
|
|
550
|
+
);
|
|
551
|
+
|
|
552
|
+
await waitFor(() => expect(screen.getByTestId('children')).toBeTruthy());
|
|
553
|
+
|
|
554
|
+
await waitFor(() => {
|
|
555
|
+
expect(optimisticStateSpy).toHaveBeenCalled();
|
|
556
|
+
expect(optimisticStateSpy.mock.calls[0][0].message_text_updated_at).toBeUndefined();
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
it('should keep the optimistic edit for attachment updates without auto-queueing', async () => {
|
|
561
|
+
const message = channel.state.messages[0];
|
|
562
|
+
const editedText = 'edited attachment message';
|
|
563
|
+
const localUri = 'file://edited-attachment.png';
|
|
564
|
+
|
|
565
|
+
render(
|
|
566
|
+
<Chat client={chatClient} enableOfflineSupport>
|
|
567
|
+
<Channel
|
|
568
|
+
channel={channel}
|
|
569
|
+
doUpdateMessageRequest={() => {
|
|
570
|
+
throw new Error('offline');
|
|
571
|
+
}}
|
|
572
|
+
>
|
|
573
|
+
<CallbackEffectWithContext
|
|
574
|
+
callback={async ({ editMessage }) => {
|
|
575
|
+
try {
|
|
576
|
+
await editMessage({
|
|
577
|
+
localMessage: {
|
|
578
|
+
...message,
|
|
579
|
+
attachments: [
|
|
580
|
+
{
|
|
581
|
+
asset_url: localUri,
|
|
582
|
+
originalFile: generateFileReference({
|
|
583
|
+
name: 'edited-attachment.png',
|
|
584
|
+
type: 'image/png',
|
|
585
|
+
uri: localUri,
|
|
586
|
+
}),
|
|
587
|
+
type: 'file',
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
cid: channel.cid,
|
|
591
|
+
text: editedText,
|
|
592
|
+
},
|
|
593
|
+
options: {},
|
|
594
|
+
});
|
|
595
|
+
} catch (e) {
|
|
596
|
+
// do nothing
|
|
597
|
+
}
|
|
598
|
+
}}
|
|
599
|
+
context={MessageInputContext}
|
|
600
|
+
>
|
|
601
|
+
<View testID='children' />
|
|
602
|
+
</CallbackEffectWithContext>
|
|
603
|
+
</Channel>
|
|
604
|
+
</Chat>,
|
|
605
|
+
);
|
|
606
|
+
|
|
607
|
+
await waitFor(() => expect(screen.getByTestId('children')).toBeTruthy());
|
|
608
|
+
|
|
609
|
+
await waitFor(async () => {
|
|
610
|
+
const updatedMessage = channel.state.findMessage(message.id);
|
|
611
|
+
const pendingTasksRows = await BetterSqlite.selectFromTable('pendingTasks');
|
|
612
|
+
const dbMessages = await BetterSqlite.selectFromTable('messages');
|
|
613
|
+
const dbMessage = dbMessages.find((row) => row.id === message.id);
|
|
614
|
+
const storedAttachments = JSON.parse(dbMessage.attachments);
|
|
615
|
+
|
|
616
|
+
expect(updatedMessage.text).toBe(editedText);
|
|
617
|
+
expect(updatedMessage.attachments[0].asset_url).toBe(localUri);
|
|
618
|
+
expect(pendingTasksRows).toHaveLength(0);
|
|
619
|
+
expect(dbMessage.text).toBe(editedText);
|
|
620
|
+
expect(storedAttachments[0].asset_url).toBe(localUri);
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
|
|
400
625
|
describe('pending task execution', () => {
|
|
401
626
|
it('pending task should be executed after connection is recovered', async () => {
|
|
402
627
|
const message = channel.state.messages[0];
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from '../../../contexts';
|
|
22
22
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
23
23
|
import { useAttachmentPickerState, useStableCallback } from '../../../hooks';
|
|
24
|
-
import { Camera, FilePickerIcon, PollThumbnail,
|
|
24
|
+
import { Camera, FilePickerIcon, PollThumbnail, VideoIcon } from '../../../icons';
|
|
25
25
|
import { primitives } from '../../../theme';
|
|
26
26
|
import { CommandSuggestionItem } from '../../AutoCompleteInput/AutoCompleteSuggestionItem';
|
|
27
27
|
|
|
@@ -197,7 +197,7 @@ export const AttachmentCameraPicker = (
|
|
|
197
197
|
/>
|
|
198
198
|
) : (
|
|
199
199
|
<AttachmentPickerGenericContent
|
|
200
|
-
Icon={videoOnly ?
|
|
200
|
+
Icon={videoOnly ? VideoIcon : Camera}
|
|
201
201
|
onPress={openCameraPicker}
|
|
202
202
|
height={height}
|
|
203
203
|
buttonText={t('Open Camera')}
|
|
@@ -19,7 +19,7 @@ import { useAttachmentPickerState } from '../../../hooks/useAttachmentPickerStat
|
|
|
19
19
|
import {
|
|
20
20
|
Camera,
|
|
21
21
|
Picture,
|
|
22
|
-
|
|
22
|
+
VideoIcon,
|
|
23
23
|
FilePickerIcon,
|
|
24
24
|
PollThumbnail,
|
|
25
25
|
CommandsIcon,
|
|
@@ -121,7 +121,7 @@ export const CameraPickerButton = () => {
|
|
|
121
121
|
/>
|
|
122
122
|
{Platform.OS === 'android' ? (
|
|
123
123
|
<AttachmentTypePickerButton
|
|
124
|
-
Icon={
|
|
124
|
+
Icon={VideoIcon}
|
|
125
125
|
selected={selectedPicker === 'camera-video'}
|
|
126
126
|
onPress={onVideoRecorderPickerPress}
|
|
127
127
|
/>
|
|
@@ -1560,10 +1560,56 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
|
|
|
1560
1560
|
);
|
|
1561
1561
|
|
|
1562
1562
|
const editMessage: InputMessageInputContextValue['editMessage'] = useStableCallback(
|
|
1563
|
-
({ localMessage, options }) =>
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1563
|
+
async ({ localMessage, options }) => {
|
|
1564
|
+
if (!channel) {
|
|
1565
|
+
throw new Error('Channel has not been initialized');
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
const cid = channel.cid;
|
|
1569
|
+
const currentMessage = channel.state.findMessage(localMessage.id, localMessage.parent_id);
|
|
1570
|
+
const isFailedMessage =
|
|
1571
|
+
currentMessage?.status === MessageStatusTypes.FAILED ||
|
|
1572
|
+
localMessage.status === MessageStatusTypes.FAILED;
|
|
1573
|
+
const optimisticEditedAt = new Date();
|
|
1574
|
+
const optimisticEditedAtString = optimisticEditedAt.toISOString();
|
|
1575
|
+
const optimisticMessage = {
|
|
1576
|
+
...currentMessage,
|
|
1577
|
+
...localMessage,
|
|
1578
|
+
cid,
|
|
1579
|
+
message_text_updated_at: isFailedMessage ? undefined : optimisticEditedAtString,
|
|
1580
|
+
updated_at: optimisticEditedAt,
|
|
1581
|
+
} as unknown as LocalMessage;
|
|
1582
|
+
|
|
1583
|
+
updateMessage(optimisticMessage);
|
|
1584
|
+
threadInstance?.updateParentMessageOrReplyLocally(
|
|
1585
|
+
optimisticMessage as unknown as MessageResponse,
|
|
1586
|
+
);
|
|
1587
|
+
client.offlineDb?.executeQuerySafely(
|
|
1588
|
+
(db) =>
|
|
1589
|
+
db.updateMessage({
|
|
1590
|
+
message: { ...optimisticMessage, cid },
|
|
1591
|
+
}),
|
|
1592
|
+
{ method: 'updateMessage' },
|
|
1593
|
+
);
|
|
1594
|
+
|
|
1595
|
+
const response = doUpdateMessageRequest
|
|
1596
|
+
? await doUpdateMessageRequest(cid, localMessage, options)
|
|
1597
|
+
: await client.updateMessage(localMessage, undefined, options);
|
|
1598
|
+
|
|
1599
|
+
if (response?.message) {
|
|
1600
|
+
updateMessage(response.message);
|
|
1601
|
+
threadInstance?.updateParentMessageOrReplyLocally(response.message);
|
|
1602
|
+
client.offlineDb?.executeQuerySafely(
|
|
1603
|
+
(db) =>
|
|
1604
|
+
db.updateMessage({
|
|
1605
|
+
message: { ...response.message, cid },
|
|
1606
|
+
}),
|
|
1607
|
+
{ method: 'updateMessage' },
|
|
1608
|
+
);
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
return response;
|
|
1612
|
+
},
|
|
1567
1613
|
);
|
|
1568
1614
|
|
|
1569
1615
|
/**
|
|
@@ -110,7 +110,7 @@ describe('useChannelActionItems', () => {
|
|
|
110
110
|
'destructive',
|
|
111
111
|
]);
|
|
112
112
|
expect(result.current.map((item) => item.placement)).toEqual([
|
|
113
|
-
'
|
|
113
|
+
'swipe',
|
|
114
114
|
'both',
|
|
115
115
|
'sheet',
|
|
116
116
|
'sheet',
|
|
@@ -266,7 +266,7 @@ describe('getChannelActionItems', () => {
|
|
|
266
266
|
|
|
267
267
|
expect(actionItems[0].action).toBe(channelActions.unmuteChannel);
|
|
268
268
|
expect(actionItems[0].label).toBe('Unmute Group');
|
|
269
|
-
expect(actionItems[0].placement).toBe('
|
|
269
|
+
expect(actionItems[0].placement).toBe('swipe');
|
|
270
270
|
|
|
271
271
|
expect(actionItems[1].action).toBe(channelActions.unarchive);
|
|
272
272
|
expect(actionItems[1].label).toBe('Unarchive Group');
|
|
@@ -112,7 +112,7 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
|
|
|
112
112
|
: muteActive
|
|
113
113
|
? t('Unmute Group')
|
|
114
114
|
: t('Mute Group'),
|
|
115
|
-
placement: isDirectChat ? 'sheet' : '
|
|
115
|
+
placement: isDirectChat ? 'sheet' : 'swipe',
|
|
116
116
|
type: 'standard',
|
|
117
117
|
},
|
|
118
118
|
];
|
|
@@ -6,7 +6,9 @@ import { Pressable } from 'react-native-gesture-handler';
|
|
|
6
6
|
|
|
7
7
|
import { Channel } from 'stream-chat';
|
|
8
8
|
|
|
9
|
+
import { ChannelPreviewMutedStatus } from './ChannelPreviewMutedStatus';
|
|
9
10
|
import { ChannelPreviewTitle } from './ChannelPreviewTitle';
|
|
11
|
+
import { useIsChannelMuted } from './hooks/useIsChannelMuted';
|
|
10
12
|
|
|
11
13
|
import { useBottomSheetContext, useTheme, useTranslationContext } from '../../contexts';
|
|
12
14
|
import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRegistryContext';
|
|
@@ -14,6 +16,7 @@ import { useStableCallback } from '../../hooks';
|
|
|
14
16
|
import { primitives } from '../../theme';
|
|
15
17
|
import { ChannelActionItem } from '../ChannelList/hooks/useChannelActionItems';
|
|
16
18
|
import { useChannelMembersState } from '../ChannelList/hooks/useChannelMembersState';
|
|
19
|
+
import { useChannelMuteActive } from '../ChannelList/hooks/useChannelMuteActive';
|
|
17
20
|
import { useChannelOnlineMemberCount } from '../ChannelList/hooks/useChannelOnlineMemberCount';
|
|
18
21
|
import { useIsDirectChat } from '../ChannelList/hooks/useIsDirectChat';
|
|
19
22
|
import { ChannelAvatar } from '../ui';
|
|
@@ -35,6 +38,9 @@ export const ChannelDetailsHeader = ({ channel }: ChannelDetailsHeaderProps) =>
|
|
|
35
38
|
const memberCount = useMemo(() => Object.keys(members).length, [members]);
|
|
36
39
|
const onlineCount = useChannelOnlineMemberCount(channel);
|
|
37
40
|
const isDirectChat = useIsDirectChat(channel);
|
|
41
|
+
const { muted: channelMuted } = useIsChannelMuted(channel);
|
|
42
|
+
const directChatUserMuted = useChannelMuteActive(channel);
|
|
43
|
+
const muted = isDirectChat ? directChatUserMuted : channelMuted;
|
|
38
44
|
const displayedMemberCount = memberCount > 9 ? '9+' : `${memberCount}`;
|
|
39
45
|
const displayedOnlineCount = onlineCount > 9 ? '9+' : `${onlineCount}`;
|
|
40
46
|
const membersAndOnlineLabel = useMemo(
|
|
@@ -51,7 +57,10 @@ export const ChannelDetailsHeader = ({ channel }: ChannelDetailsHeaderProps) =>
|
|
|
51
57
|
<View style={styles.headerContainer}>
|
|
52
58
|
<ChannelAvatar channel={channel} size={'lg'} />
|
|
53
59
|
<View style={styles.metaContainer}>
|
|
54
|
-
<
|
|
60
|
+
<View style={styles.titleContainer}>
|
|
61
|
+
<ChannelPreviewTitle channel={channel} />
|
|
62
|
+
{muted ? <ChannelPreviewMutedStatus /> : null}
|
|
63
|
+
</View>
|
|
55
64
|
<Text style={styles.headerMeta}>
|
|
56
65
|
{isDirectChat ? (onlineCount === 1 ? t('Online') : t('Offline')) : membersAndOnlineLabel}
|
|
57
66
|
</Text>
|
|
@@ -145,6 +154,11 @@ const useStyles = () => {
|
|
|
145
154
|
gap: primitives.spacingXxs,
|
|
146
155
|
...header.metaContainer,
|
|
147
156
|
},
|
|
157
|
+
titleContainer: {
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
flexDirection: 'row',
|
|
160
|
+
gap: primitives.spacingXxs,
|
|
161
|
+
},
|
|
148
162
|
itemContainer: {
|
|
149
163
|
flexDirection: 'row',
|
|
150
164
|
alignItems: 'center',
|
|
@@ -76,6 +76,7 @@ export const ChannelPreviewMessage = (props: ChannelPreviewMessageProps) => {
|
|
|
76
76
|
|
|
77
77
|
const isFailedMessage =
|
|
78
78
|
lastMessage?.status === MessageStatusTypes.FAILED || lastMessage?.type === 'error';
|
|
79
|
+
const showMessageDeliveryStatus = !isMessageDeleted;
|
|
79
80
|
|
|
80
81
|
if (usersTyping.length > 0) {
|
|
81
82
|
return <PreviewTypingIndicator channel={channel} usersTyping={usersTyping} />;
|
|
@@ -120,14 +121,18 @@ export const ChannelPreviewMessage = (props: ChannelPreviewMessageProps) => {
|
|
|
120
121
|
if (channel.data?.name || membersWithoutSelf.length > 1) {
|
|
121
122
|
return (
|
|
122
123
|
<View style={styles.container}>
|
|
123
|
-
|
|
124
|
+
{showMessageDeliveryStatus ? (
|
|
125
|
+
<PreviewMessageDeliveryStatus channel={channel} message={lastMessage} />
|
|
126
|
+
) : null}
|
|
124
127
|
<PreviewLastMessage message={lastMessage} />
|
|
125
128
|
</View>
|
|
126
129
|
);
|
|
127
130
|
} else {
|
|
128
131
|
return (
|
|
129
132
|
<View style={styles.container}>
|
|
130
|
-
|
|
133
|
+
{showMessageDeliveryStatus ? (
|
|
134
|
+
<PreviewMessageDeliveryStatus channel={channel} message={lastMessage} />
|
|
135
|
+
) : null}
|
|
131
136
|
<PreviewLastMessage message={lastMessage} />
|
|
132
137
|
</View>
|
|
133
138
|
);
|
|
@@ -7,15 +7,14 @@ import { Channel } from 'stream-chat';
|
|
|
7
7
|
|
|
8
8
|
import { ChannelDetailsBottomSheet as DefaultChannelDetailsBottomSheet } from './ChannelDetailsBottomSheet';
|
|
9
9
|
import type { ChannelDetailsBottomSheetProps } from './ChannelDetailsBottomSheet';
|
|
10
|
+
import { useIsChannelMuted } from './hooks/useIsChannelMuted';
|
|
10
11
|
|
|
11
12
|
import { useTheme } from '../../contexts';
|
|
12
13
|
import { useSwipeRegistryContext } from '../../contexts/swipeableContext/SwipeRegistryContext';
|
|
13
|
-
import {
|
|
14
|
+
import { MenuPointHorizontal, Mute, Sound } from '../../icons';
|
|
14
15
|
import { GetChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
|
|
15
16
|
import { useChannelActionItems } from '../ChannelList/hooks/useChannelActionItems';
|
|
16
|
-
import {
|
|
17
|
-
import { useChannelMuteActive } from '../ChannelList/hooks/useChannelMuteActive';
|
|
18
|
-
import { useIsDirectChat } from '../ChannelList/hooks/useIsDirectChat';
|
|
17
|
+
import { useChannelActions } from '../ChannelList/hooks/useChannelActions';
|
|
19
18
|
import {
|
|
20
19
|
BottomSheetModal,
|
|
21
20
|
RightActions,
|
|
@@ -44,8 +43,12 @@ export const ChannelSwipableWrapper = ({
|
|
|
44
43
|
swipableProps?: SwipableWrapperProps['swipableProps'];
|
|
45
44
|
}>) => {
|
|
46
45
|
const [channelDetailSheetOpen, setChannelDetailSheetOpen] = useState(false);
|
|
47
|
-
const
|
|
46
|
+
const { muteChannel, unmuteChannel } = useChannelActions(channel);
|
|
48
47
|
const channelActionItems = useChannelActionItems({ channel, getChannelActionItems });
|
|
48
|
+
const sheetItems = useMemo(
|
|
49
|
+
() => channelActionItems.filter((item) => item.placement !== 'swipe'),
|
|
50
|
+
[channelActionItems],
|
|
51
|
+
);
|
|
49
52
|
const swipableRegistry = useSwipeRegistryContext();
|
|
50
53
|
|
|
51
54
|
const {
|
|
@@ -53,19 +56,17 @@ export const ChannelSwipableWrapper = ({
|
|
|
53
56
|
} = useTheme();
|
|
54
57
|
const styles = useStyles();
|
|
55
58
|
|
|
56
|
-
const
|
|
57
|
-
const
|
|
59
|
+
const channelMuteState = useIsChannelMuted(channel);
|
|
60
|
+
const channelMuteActive = channelMuteState.muted;
|
|
58
61
|
|
|
59
62
|
const Icon = useCallback(
|
|
60
63
|
() =>
|
|
61
|
-
|
|
62
|
-
<Archive width={20} height={20} stroke={semantics.textOnAccent} />
|
|
63
|
-
) : muteActive ? (
|
|
64
|
+
channelMuteActive ? (
|
|
64
65
|
<Sound width={20} height={20} stroke={semantics.textOnAccent} />
|
|
65
66
|
) : (
|
|
66
67
|
<Mute width={20} height={20} fill={semantics.textOnAccent} />
|
|
67
68
|
),
|
|
68
|
-
[
|
|
69
|
+
[channelMuteActive, semantics.textOnAccent],
|
|
69
70
|
);
|
|
70
71
|
|
|
71
72
|
const swipableActions = useMemo<SwipableActionItem[]>(() => {
|
|
@@ -78,29 +79,25 @@ export const ChannelSwipableWrapper = ({
|
|
|
78
79
|
},
|
|
79
80
|
];
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Content: Icon,
|
|
92
|
-
contentContainerStyle: [styles.contentContainerStyle, styles.standard],
|
|
93
|
-
});
|
|
94
|
-
}
|
|
82
|
+
items.push({
|
|
83
|
+
id: 'mute',
|
|
84
|
+
action: () => {
|
|
85
|
+
const action = channelMuteActive ? unmuteChannel : muteChannel;
|
|
86
|
+
action();
|
|
87
|
+
swipableRegistry?.closeAll();
|
|
88
|
+
},
|
|
89
|
+
Content: Icon,
|
|
90
|
+
contentContainerStyle: [styles.contentContainerStyle, styles.standard],
|
|
91
|
+
});
|
|
95
92
|
|
|
96
93
|
return items;
|
|
97
94
|
}, [
|
|
98
95
|
styles.contentContainerStyle,
|
|
99
96
|
styles.elipsis,
|
|
100
97
|
styles.standard,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
channelMuteActive,
|
|
99
|
+
muteChannel,
|
|
100
|
+
unmuteChannel,
|
|
104
101
|
Icon,
|
|
105
102
|
swipableRegistry,
|
|
106
103
|
]);
|
|
@@ -127,7 +124,7 @@ export const ChannelSwipableWrapper = ({
|
|
|
127
124
|
visible={channelDetailSheetOpen}
|
|
128
125
|
height={356}
|
|
129
126
|
>
|
|
130
|
-
<ChannelDetailsBottomSheetComponent channel={channel} items={
|
|
127
|
+
<ChannelDetailsBottomSheetComponent channel={channel} items={sheetItems} />
|
|
131
128
|
</BottomSheetModal>
|
|
132
129
|
</>
|
|
133
130
|
);
|