@amityco/ts-sdk-react-native 6.26.3-3e5fb0d.0 → 6.26.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk-react-native",
3
- "version": "6.26.3-3e5fb0d.0",
3
+ "version": "6.26.3",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -90,7 +90,7 @@ export class CommentLiveCollectionController extends LiveCollectionController<
90
90
 
91
91
  const data = this.applyFilter(
92
92
  collection.data
93
- .map(id => pullFromCache<Amity.InternalComment>(['comments', 'get', id])!)
93
+ .map(id => pullFromCache<Amity.InternalComment>(['comment', 'get', id])!)
94
94
  .filter(isNonNullable)
95
95
  .map(({ data }) => data) ?? [],
96
96
  ).map(LinkedObject.comment);
@@ -109,7 +109,7 @@ export class CommentLiveCollectionController extends LiveCollectionController<
109
109
  applyFilter(data: Amity.InternalComment[]) {
110
110
  let comments = data;
111
111
 
112
- if (this.query.includeDeleted) {
112
+ if (!this.query.includeDeleted) {
113
113
  comments = filterByPropEquality(comments, 'isDeleted', false);
114
114
  }
115
115
 
@@ -117,6 +117,36 @@ export class CommentLiveCollectionController extends LiveCollectionController<
117
117
  comments = comments.filter(comment => comment.parentId === this.query.parentId);
118
118
  }
119
119
 
120
+ if (typeof this.query.hasFlag === 'boolean') {
121
+ if (this.query.hasFlag) {
122
+ comments = comments.filter(comment => comment.hashFlag != null);
123
+ } else {
124
+ comments = comments.filter(comment => comment.hashFlag == null);
125
+ }
126
+ }
127
+
128
+ if (this.query.dataTypes) {
129
+ if (this.query.dataTypes.matchType === 'exact') {
130
+ comments = comments.filter(comment => {
131
+ const sortedDataTypesQueryValue = this.query.dataTypes?.values.sort() || [];
132
+ const sortedDataTypesCommentValue = comment.dataTypes?.sort() || [];
133
+
134
+ if (sortedDataTypesCommentValue.length !== sortedDataTypesQueryValue.length) {
135
+ return false;
136
+ }
137
+
138
+ return sortedDataTypesQueryValue.every(
139
+ (value, index) => value === sortedDataTypesCommentValue[index],
140
+ );
141
+ });
142
+ }
143
+ if (this.query.dataTypes.matchType === 'any') {
144
+ comments = comments.filter(comment =>
145
+ this.query.dataTypes?.values.some(value => comment.dataTypes?.includes(value)),
146
+ );
147
+ }
148
+ }
149
+
120
150
  switch (this.query.sortBy) {
121
151
  case 'firstCreated':
122
152
  comments = comments.sort(sortByFirstCreated);
@@ -68,10 +68,16 @@ export class CommentQueryStreamController extends QueryStreamController<
68
68
  return;
69
69
  }
70
70
 
71
+ if (this.query.parentId && this.query.parentId !== comment.parentId) {
72
+ return;
73
+ }
74
+
75
+ if (!this.query.parentId && comment.parentId) {
76
+ return;
77
+ }
78
+
71
79
  if (action === EnumCommentActions.OnCommentCreated) {
72
80
  collection.data = [...new Set([comment.commentId, ...collection.data])];
73
- } else if (action === EnumCommentActions.OnCommentDeleted) {
74
- collection.data = collection.data.filter(p => p !== comment.commentId);
75
81
  }
76
82
 
77
83
  pushToCache(this.cacheKey, collection);
@@ -76,7 +76,6 @@ export const getMembers = (
76
76
  const communityMemberLiveCollection = new CommunityMembersLiveCollectionController(
77
77
  params,
78
78
  resp => {
79
- console.log('resp', resp);
80
79
  callback(resp);
81
80
  },
82
81
  );
@@ -117,7 +117,7 @@ export class CommunityLiveCollectionController extends LiveCollectionController<
117
117
 
118
118
  let communities = data;
119
119
 
120
- if (this.query.includeDeleted) {
120
+ if (!this.query.includeDeleted) {
121
121
  communities = filterByPropEquality(communities, 'isDeleted', false);
122
122
  }
123
123
 
@@ -106,7 +106,7 @@ export class SearchCommunityLiveCollectionController extends LiveCollectionContr
106
106
 
107
107
  let communities = data;
108
108
 
109
- if (this.query.includeDeleted) {
109
+ if (!this.query.includeDeleted) {
110
110
  communities = filterByPropEquality(communities, 'isDeleted', false);
111
111
  }
112
112