Skip to content

Commit

Permalink
Merge pull request #2758 from GetStream/develop
Browse files Browse the repository at this point in the history
Next Release
  • Loading branch information
isekovanic authored Nov 4, 2024
2 parents 0a4c852 + a7dd5a3 commit 2a50604
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/SampleApp/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ GEM
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
fastlane-plugin-load_json (0.0.1)
fastlane-plugin-stream_actions (0.3.69)
fastlane-plugin-stream_actions (0.3.73)
xctest_list (= 1.2.1)
ffi (1.17.0)
fourflusher (2.3.1)
Expand Down Expand Up @@ -320,7 +320,7 @@ DEPENDENCIES
fastlane
fastlane-plugin-firebase_app_distribution
fastlane-plugin-load_json
fastlane-plugin-stream_actions (= 0.3.69)
fastlane-plugin-stream_actions (= 0.3.73)
rubocop-performance
rubocop-require_tools

Expand Down
2 changes: 1 addition & 1 deletion examples/SampleApp/fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

gem 'fastlane-plugin-firebase_app_distribution'
gem 'fastlane-plugin-load_json'
gem 'fastlane-plugin-stream_actions', '0.3.69'
gem 'fastlane-plugin-stream_actions', '0.3.73'
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,8 @@ export const MessageInputProvider = <
setSelectedImages,
setSelectedPicker,
} = useAttachmentPickerContext();
const { appSettings, client, enableOfflineSupport } = useChatContext<StreamChatGenerics>();
const { appSettings, client, enableOfflineSupport, isOnline } =
useChatContext<StreamChatGenerics>();
const { removeMessage } = useMessagesContext();

const getFileUploadConfig = () => {
Expand Down Expand Up @@ -652,7 +653,7 @@ export const MessageInputProvider = <
}
setText(newText);

if (newText && channel && channelCapabities.sendTypingEvents) {
if (newText && channel && channelCapabities.sendTypingEvents && isOnline) {
logChatPromiseExecution(channel.keystroke(thread?.id), 'start typing event');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("MessageInputContext's pickFile", () => {
maxNumberOfFiles: 2,
};

it.each([[3, 2]])(
it.each([[3, 1]])(
'run pickFile when numberOfUploads is %d and alert is triggered %d number of times',
async (numberOfUploads, numberOfTimesCalled) => {
const { rerender, result } = renderHook(() => useMessageInputContext(), {
Expand All @@ -87,6 +87,7 @@ describe("MessageInputContext's pickFile", () => {
});

expect(Alert.alert).toHaveBeenCalledTimes(numberOfTimesCalled);
expect(Alert.alert).toHaveBeenCalledWith('Maximum number of files reached');
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export const useCreateMessageInputContext = <
text,
threadId,
showPollCreationDialog,
onChange,
],
);

Expand Down
1 change: 1 addition & 0 deletions package/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** i18next polyfill to handle intl format for pluralization. For more info see https://www.i18next.com/misc/json-format#i-18-next-json-v4 */
import 'intl-pluralrules';
import './polyfills';

export * from './components';
export * from './hooks';
Expand Down
28 changes: 28 additions & 0 deletions package/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function () {
if (!Array.prototype.at) {
// eslint-disable-next-line no-extend-native
Object.defineProperty(Array.prototype, 'at', {
configurable: true,
enumerable: false,
value: function at(index: number) {
// Convert to integer if index is not provided
const len = this.length;
let relativeIndex = Number(index) || 0;

// Handle negative indices
if (relativeIndex < 0) {
relativeIndex += len;
}

// Return undefined if index is out of bounds
if (relativeIndex < 0 || relativeIndex >= len) {
return undefined;
}

// Return the element at the calculated index
return this[relativeIndex];
},
writable: true,
});
}
})();

0 comments on commit 2a50604

Please sign in to comment.