@@ -1475,7 +1475,6 @@ public void gotResult(int status, String desc) {
14751475 });
14761476 }
14771477
1478-
14791478 void downloadThumbGroupAvatar (JSONArray data , final CallbackContext callback ) {
14801479 String id ;
14811480
@@ -1495,7 +1494,7 @@ public void gotResult(int status, String desc, GroupInfo groupInfo) {
14951494 File avatarFile = groupInfo .getAvatarFile ();
14961495 JSONObject result = new JSONObject ();
14971496 try {
1498- result .put ("id" , groupInfo .getGroupID ()+ "" );
1497+ result .put ("id" , groupInfo .getGroupID () + "" );
14991498 String avatarFilePath = (avatarFile == null ? "" : avatarFile .getAbsolutePath ());
15001499 result .put ("filePath" , avatarFilePath );
15011500 } catch (JSONException e ) {
@@ -1546,7 +1545,7 @@ public void gotResult(int status, String desc, Bitmap bitmap) {
15461545
15471546 try {
15481547 JSONObject result = new JSONObject ();
1549- result .put ("id" , groupInfo .getGroupID ()+ "" );
1548+ result .put ("id" , groupInfo .getGroupID () + "" );
15501549 result .put ("filePath" , filePath );
15511550 callback .success (result );
15521551 } catch (JSONException e ) {
@@ -1559,7 +1558,7 @@ public void gotResult(int status, String desc, Bitmap bitmap) {
15591558 } else {
15601559 JSONObject result = new JSONObject ();
15611560 try {
1562- result .put ("id" , groupInfo .getGroupID ()+ "" );
1561+ result .put ("id" , groupInfo .getGroupID () + "" );
15631562 result .put ("filePath" , groupInfo .getBigAvatarFile ().getAbsolutePath ());
15641563 callback .success (result );
15651564 } catch (JSONException e ) {
@@ -2353,13 +2352,11 @@ public void gotResult(int status, String desc) {
23532352 GroupApprovalEvent groupApprovalEvent = groupApprovalEventList .get (i );
23542353 final int finalI = i ;
23552354 groupApprovalEvent .refuseGroupApproval (groupApprovalEvent .getFromUsername (),
2356- groupApprovalEvent .getfromUserAppKey (),
2357- reason ,
2358- new BasicCallback () {
2355+ groupApprovalEvent .getfromUserAppKey (), reason , new BasicCallback () {
23592356 @ Override
23602357 public void gotResult (int status , String desc ) {
23612358 // 统一返回最后一个拒绝结果
2362- if (finalI == groupApprovalEventList .size ()- 1 ) {
2359+ if (finalI == groupApprovalEventList .size () - 1 ) {
23632360 handleResult (status , desc , callback );
23642361 }
23652362 }
@@ -2393,6 +2390,40 @@ public void gotResult(int status, String desc) {
23932390
23942391 }
23952392
2393+ void setGroupNickname (JSONArray data , final CallbackContext callback ) {
2394+ long groupId ;
2395+ String username ;
2396+ String appKey ;
2397+ String nickName ;
2398+ try {
2399+ JSONObject params = data .getJSONObject (0 );
2400+ groupId = Long .parseLong (params .getString ("groupId" ));
2401+ username = params .getString ("username" );
2402+ nickName = params .getString ("nickName" );
2403+ appKey = params .has ("appKey" ) ? params .getString ("appKey" ) : "" ;
2404+ } catch (JSONException e ) {
2405+ e .printStackTrace ();
2406+ handleResult (ERR_CODE_PARAMETER , ERR_MSG_PARAMETER , callback );
2407+ return ;
2408+ }
2409+ JMessageClient .getGroupInfo (groupId , new GetGroupInfoCallback () {
2410+ @ Override
2411+ public void gotResult (int status , String desc , GroupInfo groupInfo ) {
2412+ if (status == 0 ) {
2413+ groupInfo .setMemNickname (username , appKey , nickName , new BasicCallback () {
2414+ @ Override
2415+ public void gotResult (int i , String s ) {
2416+ handleResult (status , desc , callback );
2417+ }
2418+ });
2419+ } else {
2420+ handleResult (status , desc , callback );
2421+ }
2422+ }
2423+ });
2424+
2425+ }
2426+
23962427 void transferGroupOwner (JSONArray data , final CallbackContext callback ) {
23972428 long groupId ;
23982429 String username ;
@@ -2486,7 +2517,6 @@ public void gotResult(int status, String desc, GroupInfo groupInfo) {
24862517 e .printStackTrace ();
24872518 }
24882519
2489-
24902520 } else {
24912521 handleResult (status , desc , callback );
24922522 }
@@ -2520,7 +2550,6 @@ public void gotResult(int status, String desc, GroupInfo groupInfo) {
25202550
25212551 }
25222552
2523-
25242553 // 群组相关 - end
25252554
25262555 // 事件处理 - start
0 commit comments