hrxiang 4 years ago
parent cdb68da336
commit e9f87aaf6f
  1. 20
      lib/src/listener/friendship_listener.dart
  2. 19
      lib/src/manager/im_manager.dart

@ -1,19 +1,21 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class FriendshipListener {
void onBlackListAdd(dynamic u) {}
void onBlackListAdd(UserInfo u) {}
void onBlackListDeleted(dynamic u) {}
void onBlackListDeleted(UserInfo u) {}
void onFriendApplicationListAccept(dynamic u) {}
void onFriendApplicationListAccept(UserInfo u) {}
void onFriendApplicationListAdded(dynamic u) {}
void onFriendApplicationListAdded(UserInfo u) {}
void onFriendApplicationListDeleted(dynamic u) {}
void onFriendApplicationListDeleted(UserInfo u) {}
void onFriendApplicationListReject(dynamic u) {}
void onFriendApplicationListReject(UserInfo u) {}
void onFriendInfoChanged(dynamic u) {}
void onFriendInfoChanged(UserInfo u) {}
void onFriendListAdded(dynamic u) {}
void onFriendListAdded(UserInfo u) {}
void onFriendListDeleted(dynamic u) {}
void onFriendListDeleted(UserInfo u) {}
}

@ -216,37 +216,38 @@ class IMManager {
} else if (call.method == ListenerType.friendListener) {
String type = call.arguments['type'];
dynamic data = call.arguments['data'];
UserInfo u = UserInfo.fromJson(_formatJson(data));
switch (type) {
case 'onBlackListAdd':
friendshipManager.friendshipListener.onBlackListAdd(data);
friendshipManager.friendshipListener.onBlackListAdd(u);
break;
case 'onBlackListDeleted':
friendshipManager.friendshipListener.onBlackListDeleted(data);
friendshipManager.friendshipListener.onBlackListDeleted(u);
break;
case 'onFriendApplicationListAccept':
friendshipManager.friendshipListener
.onFriendApplicationListAccept(data);
.onFriendApplicationListAccept(u);
break;
case 'onFriendApplicationListAdded':
friendshipManager.friendshipListener
.onFriendApplicationListAdded(data);
.onFriendApplicationListAdded(u);
break;
case 'onFriendApplicationListDeleted':
friendshipManager.friendshipListener
.onFriendApplicationListDeleted(data);
.onFriendApplicationListDeleted(u);
break;
case 'onFriendApplicationListReject':
friendshipManager.friendshipListener
.onFriendApplicationListReject(data);
.onFriendApplicationListReject(u);
break;
case 'onFriendInfoChanged':
friendshipManager.friendshipListener.onFriendInfoChanged(data);
friendshipManager.friendshipListener.onFriendInfoChanged(u);
break;
case 'onFriendListAdded':
friendshipManager.friendshipListener.onFriendListAdded(data);
friendshipManager.friendshipListener.onFriendListAdded(u);
break;
case 'onFriendListDeleted':
friendshipManager.friendshipListener.onFriendListDeleted(data);
friendshipManager.friendshipListener.onFriendListDeleted(u);
break;
}
}

Loading…
Cancel
Save