@@ -308,7 +308,7 @@ public void createSendMessage(ReadableMap map, Callback callback) {
308308 content = new ImageContent (new File (path ));
309309 } else if (type .equals (Constant .VOICE )) {
310310 String path = map .getString (Constant .PATH );
311- File file = new File (map . getString ( path ) );
311+ File file = new File (path );
312312 MediaPlayer mediaPlayer = MediaPlayer .create (mContext , Uri .parse (path ));
313313 int duration = mediaPlayer .getDuration () / 1000 ; // Millisecond to second.
314314 content = new VoiceContent (file , duration );
@@ -1473,7 +1473,7 @@ public void getChatRoomListByApp(ReadableMap param, final Callback success, fina
14731473 @ Override
14741474 public void gotResult (int status , String desc , List <ChatRoomInfo > chatRoomInfos ) {
14751475 mJMessageUtils .handleCallbackWithArray (status , desc , success , fail ,
1476- ResultUtils .toJSArray (chatRoomInfos , fail ));
1476+ ResultUtils .toJSArray (chatRoomInfos ));
14771477 }
14781478 });
14791479 } catch (Exception e ) {
@@ -1493,7 +1493,7 @@ public void getChatRoomListByUser(final Callback success, final Callback fail) {
14931493 ChatRoomManager .getChatRoomListByUser (new RequestCallback <List <ChatRoomInfo >>() {
14941494 @ Override
14951495 public void gotResult (int status , String desc , List <ChatRoomInfo > list ) {
1496- mJMessageUtils .handleCallbackWithArray (status , desc , success , fail , ResultUtils .toJSArray (list , fail ));
1496+ mJMessageUtils .handleCallbackWithArray (status , desc , success , fail , ResultUtils .toJSArray (list ));
14971497 }
14981498 });
14991499 }
@@ -1516,7 +1516,36 @@ public void getChatRoomInfos(ReadableMap map, final Callback success, final Call
15161516 ChatRoomManager .getChatRoomInfos (idSet , new RequestCallback <List <ChatRoomInfo >>() {
15171517 @ Override
15181518 public void gotResult (int status , String desc , List <ChatRoomInfo > list ) {
1519- mJMessageUtils .handleCallbackWithArray (status , desc , success , fail , ResultUtils .toJSArray (list , fail ));
1519+ mJMessageUtils .handleCallbackWithArray (status , desc , success , fail , ResultUtils .toJSArray (list ));
1520+ }
1521+ });
1522+ } catch (Exception e ) {
1523+ e .printStackTrace ();
1524+ mJMessageUtils .handleError (fail , ERR_CODE_PARAMETER , ERR_MSG_PARAMETER );
1525+ }
1526+ }
1527+
1528+ /**
1529+ * 获取聊天室拥有者 UserInfo
1530+ * @param roomId 聊天室 id
1531+ * @param success 成功回调
1532+ * @param fail 失败回调
1533+ */
1534+ @ ReactMethod
1535+ public void getChatRoomOwner (String roomId , final Callback success , final Callback fail ) {
1536+ try {
1537+ long id = Long .parseLong (roomId );
1538+ Set <Long > set = new HashSet <>();
1539+ set .add (id );
1540+ ChatRoomManager .getChatRoomInfos (set , new RequestCallback <List <ChatRoomInfo >>() {
1541+ @ Override
1542+ public void gotResult (int status , String desc , List <ChatRoomInfo > list ) {
1543+ list .get (0 ).getOwnerInfo (new GetUserInfoCallback () {
1544+ @ Override
1545+ public void gotResult (int status , String desc , UserInfo userInfo ) {
1546+ mJMessageUtils .handleCallbackWithObject (status , desc , success , fail , ResultUtils .toJSObject (userInfo ));
1547+ }
1548+ });
15201549 }
15211550 });
15221551 } catch (Exception e ) {
0 commit comments