Skip to content

Commit

Permalink
fix: update addDevice definition and bump RNFB versions
Browse files Browse the repository at this point in the history
  • Loading branch information
isekovanic committed Dec 19, 2024
1 parent c4b8a15 commit 2a912d7
Show file tree
Hide file tree
Showing 6 changed files with 840 additions and 236 deletions.
4 changes: 2 additions & 2 deletions examples/SampleApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"@react-native-async-storage/async-storage": "^1.21.0",
"@react-native-camera-roll/camera-roll": "^7.8.4",
"@react-native-community/netinfo": "^11.3.2",
"@react-native-firebase/app": "^19.3.0",
"@react-native-firebase/messaging": "^19.3.0",
"@react-native-firebase/app": "21.6.0",
"@react-native-firebase/messaging": "21.6.0",
"@react-navigation/bottom-tabs": "6.6.0",
"@react-navigation/drawer": "6.7.0",
"@react-navigation/native": "^6.1.17",
Expand Down
4 changes: 2 additions & 2 deletions examples/SampleApp/src/hooks/useChatClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ export const useChatClient = () => {
if (isEnabled) {
// Register FCM token with stream chat server.
const token = await messaging().getToken();
await client.addDevice(token, 'firebase');
await client.addDevice(token, 'firebase', client.userID, 'rn-fcm');

// Listen to new FCM tokens and register them with stream chat server.
const unsubscribeTokenRefresh = messaging().onTokenRefresh(async (newToken) => {
await client.addDevice(newToken, 'firebase');
await client.addDevice(newToken, 'firebase', client.userID, 'rn-fcm');
});
// show notifications when on foreground
const unsubscribeForegroundMessageReceive = messaging().onMessage(async (remoteMessage) => {
Expand Down
9 changes: 6 additions & 3 deletions examples/SampleApp/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type { Immutable } from 'seamless-immutable';
import type { Channel, UserResponse } from 'stream-chat';
import type { Channel, ExtendableGenerics, UserResponse, DefaultGenerics } from 'stream-chat';
import type { ThreadContextValue } from 'stream-chat-react-native';
import type { Theme } from '@react-navigation/native';
import { DefaultStreamChatGenerics } from 'stream-chat-react-native';

export type LocalAttachmentType = {
file_size?: number;
mime_type?: string;
};
export type LocalChannelType = Record<string, unknown>;
export type LocalCommandType = string;
export type LocalCommandType = string & {};
export type LocalEventType = Record<string, unknown>;
export type LocalMessageType = Record<string, unknown>;
export type LocalReactionType = Record<string, unknown>;
Expand All @@ -30,7 +31,9 @@ export type StreamChatGenerics = {
pollType: LocalPollType;
reactionType: LocalReactionType;
userType: LocalUserType;
};
}

// export type StreamChatGenerics = DefaultGenerics;

export type DrawerNavigatorParamList = {
HomeScreen: undefined;
Expand Down
Loading

0 comments on commit 2a912d7

Please sign in to comment.