Skip to content

Commit 3820dd7

Browse files
authored
Merge pull request #1475 from GetStream/develop
Next release
2 parents 56c7875 + 41e92cd commit 3820dd7

File tree

40 files changed

+560
-139
lines changed

40 files changed

+560
-139
lines changed

examples/SampleApp/App.tsx

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,28 @@ const App = () => {
116116
backgroundColor: streamChatTheme.colors?.white_snow || '#FCFCFC',
117117
}}
118118
>
119-
<NavigationContainer
120-
ref={RootNavigationRef}
121-
theme={{
122-
colors: {
123-
...(colorScheme === 'dark' ? DarkTheme : DefaultTheme).colors,
124-
background: streamChatTheme.colors?.white_snow || '#FCFCFC',
125-
},
126-
dark: colorScheme === 'dark',
127-
}}
128-
>
129-
<AppContext.Provider value={{ chatClient, loginUser, logout, switchUser }}>
130-
{isConnecting ? (
131-
<LoadingScreen />
132-
) : chatClient ? (
133-
<DrawerNavigatorWrapper chatClient={chatClient} />
134-
) : (
135-
<UserSelector />
136-
)}
137-
</AppContext.Provider>
138-
</NavigationContainer>
119+
<ThemeProvider style={streamChatTheme}>
120+
<NavigationContainer
121+
ref={RootNavigationRef}
122+
theme={{
123+
colors: {
124+
...(colorScheme === 'dark' ? DarkTheme : DefaultTheme).colors,
125+
background: streamChatTheme.colors?.white_snow || '#FCFCFC',
126+
},
127+
dark: colorScheme === 'dark',
128+
}}
129+
>
130+
<AppContext.Provider value={{ chatClient, loginUser, logout, switchUser }}>
131+
{isConnecting ? (
132+
<LoadingScreen />
133+
) : chatClient ? (
134+
<DrawerNavigatorWrapper chatClient={chatClient} />
135+
) : (
136+
<UserSelector />
137+
)}
138+
</AppContext.Provider>
139+
</NavigationContainer>
140+
</ThemeProvider>
139141
</SafeAreaProvider>
140142
);
141143
};
@@ -175,26 +177,20 @@ const DrawerNavigatorWrapper: React.FC<{
175177
);
176178
};
177179

178-
const UserSelector = () => {
179-
const streamChatTheme = useStreamChatTheme();
180-
181-
return (
182-
<ThemeProvider style={streamChatTheme}>
183-
<UserSelectorStack.Navigator initialRouteName='UserSelectorScreen'>
184-
<UserSelectorStack.Screen
185-
component={AdvancedUserSelectorScreen}
186-
name='AdvancedUserSelectorScreen'
187-
options={{ gestureEnabled: false, headerShown: false }}
188-
/>
189-
<UserSelectorStack.Screen
190-
component={UserSelectorScreen}
191-
name='UserSelectorScreen'
192-
options={{ gestureEnabled: false, headerShown: false }}
193-
/>
194-
</UserSelectorStack.Navigator>
195-
</ThemeProvider>
196-
);
197-
};
180+
const UserSelector = () => (
181+
<UserSelectorStack.Navigator initialRouteName='UserSelectorScreen'>
182+
<UserSelectorStack.Screen
183+
component={AdvancedUserSelectorScreen}
184+
name='AdvancedUserSelectorScreen'
185+
options={{ gestureEnabled: false, headerShown: false }}
186+
/>
187+
<UserSelectorStack.Screen
188+
component={UserSelectorScreen}
189+
name='UserSelectorScreen'
190+
options={{ gestureEnabled: false, headerShown: false }}
191+
/>
192+
</UserSelectorStack.Navigator>
193+
);
198194

199195
// TODO: Split the stack into multiple stacks - ChannelStack, CreateChannelStack etc.
200196
const HomeScreen = () => {

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 = 116;
517+
CURRENT_PROJECT_VERSION = 119;
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 = 116;
548+
CURRENT_PROJECT_VERSION = 119;
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.6.1</string>
20+
<string>1.7.0</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>116</string>
24+
<string>119</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.6.1</string>
18+
<string>1.7.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>116</string>
22+
<string>119</string>
2323
</dict>
2424
</plist>

package/src/components/Attachment/Card.tsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import {
3-
Image,
3+
ImageBackground,
44
ImageStyle,
55
StyleProp,
66
StyleSheet,
@@ -24,6 +24,7 @@ import {
2424
useMessagesContext,
2525
} from '../../contexts/messagesContext/MessagesContext';
2626
import { useTheme } from '../../contexts/themeContext/ThemeContext';
27+
import { Play } from '../../icons/Play';
2728
import type { DefaultStreamChatGenerics } from '../../types/types';
2829
import { makeImageCompatibleUrl } from '../../utils/utils';
2930

@@ -41,13 +42,15 @@ const styles = StyleSheet.create({
4142
},
4243
authorNameMask: {
4344
bottom: 0,
44-
left: 8,
45+
left: 2,
4546
position: 'absolute',
4647
},
4748
cardCover: {
49+
alignItems: 'center',
4850
borderRadius: 8,
4951
height: 140,
50-
marginHorizontal: 8,
52+
justifyContent: 'center',
53+
marginHorizontal: 2,
5154
},
5255
cardFooter: {
5356
flexDirection: 'row',
@@ -62,6 +65,14 @@ const styles = StyleSheet.create({
6265
fontSize: 12,
6366
marginHorizontal: 8,
6467
},
68+
playButtonStyle: {
69+
alignItems: 'center',
70+
borderRadius: 50,
71+
elevation: 2,
72+
height: 36,
73+
justifyContent: 'center',
74+
width: 36,
75+
},
6576
title: {
6677
fontSize: 12,
6778
marginHorizontal: 8,
@@ -116,11 +127,12 @@ const CardWithContext = <
116127
text,
117128
thumb_url,
118129
title,
130+
type,
119131
} = props;
120132

121133
const {
122134
theme: {
123-
colors: { accent_blue, black, blue_alice, transparent },
135+
colors: { accent_blue, black, blue_alice, transparent, white },
124136
messageSimple: {
125137
card: {
126138
authorName,
@@ -132,6 +144,8 @@ const CardWithContext = <
132144
cover,
133145
footer: { description, title: titleStyle, ...footerStyle },
134146
noURI,
147+
playButtonStyle: { roundedView },
148+
playIcon: { height, width },
135149
},
136150
},
137151
},
@@ -141,6 +155,8 @@ const CardWithContext = <
141155

142156
const defaultOnPress = () => openUrlSafely(og_scrape_url || uri);
143157

158+
const isVideoCard = type === 'video' && og_scrape_url;
159+
144160
return (
145161
<TouchableOpacity
146162
disabled={preventPress}
@@ -181,11 +197,18 @@ const CardWithContext = <
181197
{CardCover && <CardCover {...props} />}
182198
{uri && !CardCover && (
183199
<View>
184-
<Image
200+
<ImageBackground
201+
imageStyle={styles.cardCover}
185202
resizeMode='cover'
186203
source={{ uri: makeImageCompatibleUrl(uri) }}
187204
style={[styles.cardCover, cover, stylesProp.cardCover]}
188-
/>
205+
>
206+
{isVideoCard ? (
207+
<View style={[styles.playButtonStyle, roundedView, { backgroundColor: white }]}>
208+
<Play height={height} pathFill={black} width={width} />
209+
</View>
210+
) : null}
211+
</ImageBackground>
189212
{author_name && (
190213
<View style={[styles.authorNameMask, authorNameMask, stylesProp.authorNameMask]}>
191214
<View

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
88
import {
99
generateAttachmentAction,
1010
generateAudioAttachment,
11-
generateCardAttachment,
1211
generateFileAttachment,
1312
generateImageAttachment,
1413
} from '../../../mock-builders/generator/attachment';
@@ -107,17 +106,4 @@ describe('Attachment', () => {
107106
expect(handleAction).toHaveBeenCalledTimes(2);
108107
});
109108
});
110-
111-
it('should render "Card" if attachment type is not recognized', async () => {
112-
const { getByTestId } = render(
113-
getAttachmentComponent({
114-
attachment: generateCardAttachment({
115-
type: Date.now().toString(),
116-
}),
117-
}),
118-
);
119-
await waitFor(() => {
120-
expect(getByTestId('card-attachment')).toBeTruthy();
121-
});
122-
});
123109
});

package/src/components/Attachment/__tests__/Giphy.test.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,12 @@ describe('Giphy', () => {
251251
</OverlayProvider>,
252252
);
253253

254-
expect(queryByTestId('giphy-action-attachment')).toBeTruthy();
255-
expect(getByTestId('cancel-action-button')).toBeTruthy();
256-
expect(getByTestId('shuffle-action-button')).toBeTruthy();
257-
expect(getByTestId('send-action-button')).toBeTruthy();
254+
await waitFor(() => {
255+
expect(queryByTestId('giphy-action-attachment')).toBeTruthy();
256+
expect(getByTestId('cancel-action-button')).toBeTruthy();
257+
expect(getByTestId('shuffle-action-button')).toBeTruthy();
258+
expect(getByTestId('send-action-button')).toBeTruthy();
259+
});
258260
});
259261

260262
it('giphy attachment UI should render within the message list', async () => {
@@ -285,6 +287,8 @@ describe('Giphy', () => {
285287
</OverlayProvider>,
286288
);
287289

288-
expect(queryByTestId('giphy-attachment')).toBeTruthy();
290+
await waitFor(() => {
291+
expect(queryByTestId('giphy-attachment')).toBeTruthy();
292+
});
289293
});
290294
});

package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export const AutoCompleteSuggestionList = <
197197
) => {
198198
const { AutoCompleteSuggestionHeader, AutoCompleteSuggestionItem } =
199199
useSuggestionsContext<StreamChatGenerics>();
200+
200201
return (
201202
<MemoizedAutoCompleteSuggestionList
202203
{...{ AutoCompleteSuggestionHeader, AutoCompleteSuggestionItem }}

package/src/components/ImageGallery/components/__tests__/ImageGalleryHeader.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { useSharedValue } from 'react-native-reanimated';
44

55
import { renderHook } from '@testing-library/react-hooks';
66

7-
import { render } from '@testing-library/react-native';
7+
import { render, waitFor } from '@testing-library/react-native';
88

99
import { ThemeProvider } from '../../../../contexts/themeContext/ThemeContext';
1010

1111
import { ImageGalleryHeader } from '../ImageGalleryHeader';
1212

13-
it('doesnt fail if fromNow is not available on first render', () => {
13+
it('doesnt fail if fromNow is not available on first render', async () => {
1414
try {
1515
let sharedValueOpacity: Animated.SharedValue<number>;
1616
let sharedValueVisible: Animated.SharedValue<number>;
@@ -32,7 +32,9 @@ it('doesnt fail if fromNow is not available on first render', () => {
3232
/>
3333
</ThemeProvider>,
3434
);
35-
expect(getAllByText('Unknown User')).toBeTruthy();
35+
await waitFor(() => {
36+
expect(getAllByText('Unknown User')).toBeTruthy();
37+
});
3638
} catch (error: unknown) {
3739
if (error instanceof Error) {
3840
throw new Error(`Error encountered on first render of ImageGalleryHeader: ${error.message}`);

package/src/components/MessageInput/SendMessageDisallowedIndicator.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const SendMessageDisallowedIndicator = () => {
2727
},
2828
},
2929
} = useTheme();
30+
3031
return (
3132
<View
3233
style={[

0 commit comments

Comments
 (0)