Skip to content

Commit 095b1e7

Browse files
authored
Merge pull request #1629 from GetStream/develop
Next Release
2 parents bc2a3cf + fc501b6 commit 095b1e7

File tree

12 files changed

+114
-31
lines changed

12 files changed

+114
-31
lines changed

.github/workflows/sample-distribution.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ jobs:
3030
yarn && yarn bootstrap-ci;
3131
cd package/native-package
3232
yarn;
33+
- name: Cache iOS pods
34+
uses: actions/cache@v2
35+
with:
36+
path: examples/SampleApp/ios/Pods
37+
key: ${{ runner.os }}-pods-${{ hashFiles('examples/SampleApp/ios/Podfile.lock') }}
38+
restore-keys: |
39+
${{ runner.os }}-pods-
3340
- name: iOS Pods setup
3441
uses: nick-invision/retry@v2
3542
with:

docusaurus/docs/reactnative/basics/troubleshooting.mdx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,15 @@ You will need to add some modules in your `android/app/build.gradle`
236236

237237
```java
238238
dependencies {
239-
// For Android versions less than Ice Cream Sandwich (API level 14)
240-
implementation 'com.facebook.fresco:animated-base-support:1.3.0'
239+
// For animated GIF support
240+
implementation 'com.facebook.fresco:animated-gif:2.6.0'
241241

242-
// For GIF support
243-
implementation 'com.facebook.fresco:animated-gif:2.0.0'
242+
// For WebP support, including animated WebP
243+
implementation 'com.facebook.fresco:animated-webp:2.6.0'
244+
implementation 'com.facebook.fresco:webpsupport:2.6.0'
244245

245-
// For WebP support, with animations
246-
implementation 'com.facebook.fresco:animated-webp:2.1.0'
247-
248-
// For WebP support, without animations
249-
implementation 'com.facebook.fresco:webpsupport:2.0.0'
246+
// Provide the Android support library (you might already have this or a similar dependency)
247+
implementation 'com.android.support:support-core-utils:24.2.1'
250248
...
251249
}
252250
```

examples/SampleApp/fastlane/Fastfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ platform :ios do
8484

8585
package = load_json(json_path: "./package.json")
8686
increment_version_number(version_number: package["version"], xcodeproj: "./ios/SampleApp.xcodeproj")
87-
increment_build_number(xcodeproj: "./ios/SampleApp.xcodeproj")
87+
current_build_number = app_store_build_number(
88+
live: false,
89+
app_identifier: "io.getstream.reactnative.SampleApp",
90+
)
91+
increment_build_number(
92+
build_number: current_build_number + 1,
93+
xcodeproj: "./ios/SampleApp.xcodeproj"
94+
)
8895

8996
gym(
9097
workspace: "./ios/SampleApp.xcworkspace",
@@ -112,12 +119,5 @@ platform :ios do
112119
end
113120
end
114121

115-
commit_version_bump(
116-
message: "[fastlane][ios] Bump version [skip ci]",
117-
xcodeproj: "./ios/SampleApp.xcodeproj",
118-
force: true # otherwise untracked files may crash the CI build
119-
)
120-
121-
push_to_git_remote()
122122
end
123123
end

examples/SampleApp/ios/SampleApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@
514514
CLANG_ENABLE_MODULES = YES;
515515
CODE_SIGN_ENTITLEMENTS = SampleApp/SampleAppDebug.entitlements;
516516
CODE_SIGN_IDENTITY = "iPhone Developer";
517-
CURRENT_PROJECT_VERSION = 152;
517+
CURRENT_PROJECT_VERSION = 154;
518518
DEVELOPMENT_TEAM = EHV7XZLAHA;
519519
ENABLE_BITCODE = NO;
520520
INFOPLIST_FILE = SampleApp/Info.plist;
@@ -545,7 +545,7 @@
545545
CODE_SIGN_ENTITLEMENTS = SampleApp/SampleAppRelease.entitlements;
546546
CODE_SIGN_IDENTITY = "iPhone Distribution";
547547
CODE_SIGN_STYLE = Manual;
548-
CURRENT_PROJECT_VERSION = 152;
548+
CURRENT_PROJECT_VERSION = 154;
549549
DEVELOPMENT_TEAM = EHV7XZLAHA;
550550
INFOPLIST_FILE = SampleApp/Info.plist;
551551
LD_RUNPATH_SEARCH_PATHS = (

examples/SampleApp/ios/SampleApp/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.10.2</string>
20+
<string>1.11.0</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>152</string>
24+
<string>154</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true />
2727
<key>NSAppTransportSecurity</key>

examples/SampleApp/ios/SampleAppTests/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.10.2</string>
18+
<string>1.11.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>152</string>
22+
<string>154</string>
2323
</dict>
2424
</plist>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
*
3+
* @param giphyUrl The giphy attachment url
4+
* @returns mimeType for the giphy attachment
5+
*/
6+
export function getGiphyMimeType(giphyUrl: string): string {
7+
if (giphyUrl.includes('.mp4')) {
8+
return 'video/mp4';
9+
} else if (giphyUrl.includes('.webp')) {
10+
return 'image/webp';
11+
}
12+
return 'image/gif';
13+
}

package/src/components/ChannelList/__tests__/ChannelList.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,34 @@ describe('ChannelList', () => {
246246
});
247247
});
248248

249+
it('should add channel to top if channel is hidden from the list', async () => {
250+
const { getAllByRole, getByTestId, getByText } = render(
251+
<Chat client={chatClient}>
252+
<ChannelList {...props} />
253+
</Chat>,
254+
);
255+
256+
await waitFor(() => expect(getByTestId('channel-list')).toBeTruthy());
257+
act(() => dispatchChannelHiddenEvent(chatClient, testChannel3.channel));
258+
259+
const newItems = getAllByRole('list-item');
260+
await waitFor(() => {
261+
expect(newItems).toHaveLength(2);
262+
});
263+
264+
const newMessage = sendNewMessageOnChannel3();
265+
266+
await waitFor(() => {
267+
expect(getByText(newMessage.text)).toBeTruthy();
268+
});
269+
270+
const items = getAllByRole('list-item');
271+
272+
await waitFor(() => {
273+
expect(within(items[0]).getByText(newMessage.text)).toBeTruthy();
274+
});
275+
});
276+
249277
it('should not alter order if `lockChannelOrder` prop is true', async () => {
250278
const { getAllByRole, getByTestId, getByText } = render(
251279
<Chat client={chatClient}>

package/src/components/ChannelList/hooks/listeners/useNewMessage.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,26 @@ export const useNewMessage = <
2424
useEffect(() => {
2525
const handleEvent = (event: Event<StreamChatGenerics>) => {
2626
setChannels((channels) => {
27-
if (!lockChannelOrder && event.cid) {
28-
return moveChannelUp<StreamChatGenerics>({
29-
channels,
30-
cid: event.cid,
31-
});
27+
if (!lockChannelOrder && event.cid && event.channel_type && event.channel_id) {
28+
const targetChannelIndex = channels.findIndex((c) => c.cid === event.cid);
29+
30+
if (targetChannelIndex >= 0) {
31+
return moveChannelUp<StreamChatGenerics>({
32+
channels,
33+
cid: event.cid,
34+
});
35+
}
36+
37+
// If channel doesn't exist in existing list, check in activeChannels as well.
38+
// It may happen that channel was hidden using channel.hide(). In that case
39+
// We remove it from `channels` state, but its still being watched and exists in client.activeChannels.
40+
const channel = client.channel(event.channel_type, event.channel_id);
41+
42+
if (channel.initialized) {
43+
return [channel, ...channels];
44+
}
3245
}
46+
3347
return [...channels];
3448
});
3549
};

package/src/components/ImageGallery/ImageGallery.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import type { DefaultStreamChatGenerics } from '../../types/types';
6565
import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
6666
import { getUrlOfImageAttachment } from '../../utils/getUrlOfImageAttachment';
6767
import { vh, vw } from '../../utils/utils';
68+
import { getGiphyMimeType } from '../Attachment/utils/getGiphyMimeType';
6869

6970
const isAndroid = Platform.OS === 'android';
7071
const fullScreenHeight = Dimensions.get('screen').height;
@@ -280,7 +281,7 @@ export const ImageGallery = <
280281
created_at: cur.created_at,
281282
id: `photoId-${cur.id}-${imageUrl}`,
282283
messageId: cur.id,
283-
mime_type: a.type === 'giphy' ? 'image/gif' : a.mime_type,
284+
mime_type: a.type === 'giphy' ? getGiphyMimeType(giphyURL ?? '') : a.mime_type,
284285
original_height: a.original_height,
285286
original_width: a.original_width,
286287
type: a.type,

0 commit comments

Comments
 (0)