Skip to content

Commit 24246df

Browse files
authored
fix: types change & params compatibility (#52)
1 parent 53cf5d5 commit 24246df

File tree

8 files changed

+56
-43
lines changed

8 files changed

+56
-43
lines changed

android/src/main/java/com/openimsdkrn/OpenImSdkRnModule.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,10 @@ public void setFriendListener() {
732732

733733
public void getSpecifiedFriendsInfo(ReadableMap options, String operationID, Promise promise) {
734734
ReadableArray userIDList = options.getArray("userIDList");
735-
boolean filterBlack = options.getBoolean("filterBlack");
735+
boolean filterBlack = false;
736+
if (options.hasKey("filterBlack")) {
737+
filterBlack = options.getBoolean("filterBlack");
738+
}
736739
Open_im_sdk.getSpecifiedFriendsInfo(new BaseImpl(promise), operationID, userIDList.toString(), filterBlack);
737740
}
738741

@@ -745,7 +748,10 @@ public void getFriendList(Boolean filterBlack, String operationID, Promise promi
745748
public void getFriendListPage(ReadableMap options, String operationID, Promise promise) {
746749
int offset = options.getInt("offset");
747750
int count = options.getInt("count");
748-
boolean filterBlack = options.getBoolean("filterBlack");
751+
boolean filterBlack = false;
752+
if (options.hasKey("filterBlack")) {
753+
filterBlack = options.getBoolean("filterBlack");
754+
}
749755
Open_im_sdk.getFriendListPage(new BaseImpl(promise), operationID, offset, count, filterBlack);
750756
}
751757

example/src/App.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ import { MessageItem } from 'src/types/entity';
77
function App(): React.JSX.Element {
88
RNFS.mkdir(RNFS.DocumentDirectoryPath + '/tmp');
99
const init = async () => {
10-
// platformID ios 1 android 2
1110
try {
1211
await OpenIMSDKRN.initSDK(
1312
{
14-
platformID: 2,
15-
apiAddr: 'http://192.168.2.16:10002',
16-
wsAddr: 'ws://192.168.2.16:10001',
13+
apiAddr: 'http://127.0.0.1:10002',
14+
wsAddr: 'ws://127.0.0.1:10001',
1715
dataDir: RNFS.DocumentDirectoryPath + '/tmp',
1816
logLevel: 5,
1917
isLogStandardOutput: true,
@@ -28,11 +26,10 @@ function App(): React.JSX.Element {
2826

2927
const iosLogin = async () => {
3028
try {
31-
await OpenIMSDKRN.login(
29+
await OpenIMSDKRN.login(
3230
{
3331
userID: '3742375535',
34-
token:
35-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiIzNzQyMzc1NTM1IiwiUGxhdGZvcm1JRCI6MSwiZXhwIjoxNzE3NTY4ODQyLCJuYmYiOjE3MDk3OTI1NDIsImlhdCI6MTcwOTc5Mjg0Mn0.xPPgeXysWhqnvp5Xk5qFERqRRuPLTCq7kDP0wPElu9I',
32+
token: 'xxx',
3633
},
3734
'hrtyy45t'
3835
);
@@ -47,8 +44,7 @@ function App(): React.JSX.Element {
4744
await OpenIMSDKRN.login(
4845
{
4946
userID: '3742375535',
50-
token:
51-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiIzNzQyMzc1NTM1IiwiUGxhdGZvcm1JRCI6MiwiZXhwIjoxNzE3NjYwODg1LCJuYmYiOjE3MDk4ODQ1ODUsImlhdCI6MTcwOTg4NDg4NX0.0yPd2G78HLsvAldMHPLancm4BTMfefOItUwLqYmJxu8',
47+
token: 'xx',
5248
},
5349
'hrtyy45t'
5450
);

ios/OpenImSdkRn.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ - (dispatch_queue_t)methodQueue {
6565
@"onRecvOfflineNewMessages",
6666
@"onMsgDeleted" ,
6767
@"onRecvC2CReadReceipt",
68+
@"onNewRecvMessageRevoked",
6869
@"onRecvMessageRevoked",
69-
@"onRecvGroupReadReceipt",
7070
@"onRecvNewMessage",
7171
@"onRecvOfflineNewMessage",
7272
@"onRecvOnlineOnlyMessage",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "open-im-sdk-rn",
3-
"version": "3.8.1",
3+
"version": "3.8.2-alpha.1",
44
"description": "OpenIM SDK for react-native",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

src/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,12 @@ interface OpenIMSDKRNInterface {
165165
getFriendApplicationListAsRecipient: (
166166
operationID: string
167167
) => Promise<FriendApplicationItem[]>;
168-
getFriendList: (operationID: string) => Promise<FriendUserItem[]>;
168+
getFriendList: (
169+
filterBlack: boolean,
170+
operationID: string
171+
) => Promise<FriendUserItem[]>;
169172
getFriendListPage: (
170-
params: OffsetParams,
173+
params: OffsetParams & { filterBlack?: boolean },
171174
operationID: string
172175
) => Promise<FriendUserItem[]>;
173176
getSpecifiedFriendsInfo: (

src/types/entity.ts

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export type PublicUserItem = {
7878
nickname: string;
7979
userID: string;
8080
faceURL: string;
81-
ex?: string;
81+
ex: string;
8282
};
8383
export type SelfUserInfo = {
8484
createTime: number;
@@ -101,6 +101,7 @@ export type FriendUserItem = {
101101
operatorUserID: string;
102102
ownerUserID: string;
103103
remark: string;
104+
isPinned: boolean;
104105
attachedInfo: string;
105106
};
106107
export type SearchedFriendsInfo = FriendUserItem & {
@@ -138,6 +139,7 @@ export type GroupItem = {
138139
ex: string;
139140
applyMemberFriend: AllowType;
140141
lookMemberInfo: AllowType;
142+
displayIsRead: boolean;
141143
};
142144
export type GroupMemberItem = {
143145
groupID: string;
@@ -173,7 +175,7 @@ export type ConversationItem = {
173175
isPrivateChat: boolean;
174176
isMsgDestruct: boolean;
175177
attachedInfo: string;
176-
ex: string;
178+
ex?: string;
177179
};
178180
export type MessageItem = {
179181
clientMsgID: string;
@@ -193,27 +195,26 @@ export type MessageItem = {
193195
seq: number;
194196
isRead: boolean;
195197
status: MessageStatus;
196-
isReact: boolean;
197-
isExternalExtensions: boolean;
198-
offlinePush: OfflinePush;
199-
attachedInfo: string;
200-
ex: string;
201-
localEx: string;
202-
textElem: TextElem;
203-
cardElem: CardElem;
204-
pictureElem: PictureElem;
205-
soundElem: SoundElem;
206-
videoElem: VideoElem;
207-
fileElem: FileElem;
208-
mergeElem: MergeElem;
209-
atTextElem: AtTextElem;
210-
faceElem: FaceElem;
211-
locationElem: LocationElem;
212-
customElem: CustomElem;
213-
quoteElem: QuoteElem;
214-
notificationElem: NotificationElem;
215-
advancedTextElem: AdvancedTextElem;
216-
typingElem: TypingElem;
198+
isReact?: boolean;
199+
isExternalExtensions?: boolean;
200+
offlinePush?: OfflinePush;
201+
ex?: string;
202+
localEx?: string;
203+
textElem?: TextElem;
204+
cardElem?: CardElem;
205+
pictureElem?: PictureElem;
206+
soundElem?: SoundElem;
207+
videoElem?: VideoElem;
208+
fileElem?: FileElem;
209+
mergeElem?: MergeElem;
210+
atTextElem?: AtTextElem;
211+
faceElem?: FaceElem;
212+
locationElem?: LocationElem;
213+
customElem?: CustomElem;
214+
quoteElem?: QuoteElem;
215+
notificationElem?: NotificationElem;
216+
advancedTextElem?: AdvancedTextElem;
217+
typingElem?: TypingElem;
217218
attachedInfoElem: AttachedInfoElem;
218219
};
219220
export type TextElem = {
@@ -289,9 +290,8 @@ export type AttachedInfoElem = {
289290
inEncryptStatus: boolean;
290291
burnDuration: number;
291292
hasReadTime: number;
292-
notSenderNotificationPush: boolean;
293-
messageEntityList: MessageEntity[];
294-
uploadProgress: UploadProgress;
293+
messageEntityList?: MessageEntity[];
294+
uploadProgress?: UploadProgress;
295295
};
296296
export type UploadProgress = {
297297
total: number;
@@ -376,7 +376,8 @@ export type ReceiptInfo = {
376376

377377
export type SearchMessageResult = {
378378
totalCount: number;
379-
searchResultItems: SearchMessageResultItem[];
379+
searchResultItems?: SearchMessageResultItem[];
380+
findResultItems?: SearchMessageResultItem[];
380381
};
381382

382383
export type SearchMessageResultItem = {
@@ -416,6 +417,12 @@ export type UserOnlineState = {
416417
userID: string;
417418
};
418419

420+
export type ConversationInputStatus = {
421+
conversationID: string;
422+
userID: string;
423+
platformIDs: Platform[];
424+
};
425+
419426
export type GroupMessageReceiptInfo = {
420427
conversationID: string;
421428
groupMessageReadInfo: GroupMessageReadInfo[];

src/types/enum.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export enum MessageType {
7272
OANotification = 1400,
7373

7474
GroupCreated = 1501,
75+
GroupInfoUpdated = 1502,
7576
MemberQuit = 1504,
7677
GroupOwnerTransferred = 1507,
7778
MemberKicked = 1508,

src/types/params.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export type LocationMsgParams = {
295295

296296
export type QuoteMsgParams = {
297297
text: string;
298-
message: string;
298+
message: MessageItem;
299299
};
300300

301301
export type CustomMsgParams = {

0 commit comments

Comments
 (0)