Merge pull request #5 from OpenIMSDK/android

init
main
hrxiang 4 years ago committed by GitHub
commit 951dc60267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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 { 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) { } else if (call.method == ListenerType.friendListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
dynamic data = call.arguments['data']; dynamic data = call.arguments['data'];
UserInfo u = UserInfo.fromJson(_formatJson(data));
switch (type) { switch (type) {
case 'onBlackListAdd': case 'onBlackListAdd':
friendshipManager.friendshipListener.onBlackListAdd(data); friendshipManager.friendshipListener.onBlackListAdd(u);
break; break;
case 'onBlackListDeleted': case 'onBlackListDeleted':
friendshipManager.friendshipListener.onBlackListDeleted(data); friendshipManager.friendshipListener.onBlackListDeleted(u);
break; break;
case 'onFriendApplicationListAccept': case 'onFriendApplicationListAccept':
friendshipManager.friendshipListener friendshipManager.friendshipListener
.onFriendApplicationListAccept(data); .onFriendApplicationListAccept(u);
break; break;
case 'onFriendApplicationListAdded': case 'onFriendApplicationListAdded':
friendshipManager.friendshipListener friendshipManager.friendshipListener
.onFriendApplicationListAdded(data); .onFriendApplicationListAdded(u);
break; break;
case 'onFriendApplicationListDeleted': case 'onFriendApplicationListDeleted':
friendshipManager.friendshipListener friendshipManager.friendshipListener
.onFriendApplicationListDeleted(data); .onFriendApplicationListDeleted(u);
break; break;
case 'onFriendApplicationListReject': case 'onFriendApplicationListReject':
friendshipManager.friendshipListener friendshipManager.friendshipListener
.onFriendApplicationListReject(data); .onFriendApplicationListReject(u);
break; break;
case 'onFriendInfoChanged': case 'onFriendInfoChanged':
friendshipManager.friendshipListener.onFriendInfoChanged(data); friendshipManager.friendshipListener.onFriendInfoChanged(u);
break; break;
case 'onFriendListAdded': case 'onFriendListAdded':
friendshipManager.friendshipListener.onFriendListAdded(data); friendshipManager.friendshipListener.onFriendListAdded(u);
break; break;
case 'onFriendListDeleted': case 'onFriendListDeleted':
friendshipManager.friendshipListener.onFriendListDeleted(data); friendshipManager.friendshipListener.onFriendListDeleted(u);
break; break;
} }
} }

Loading…
Cancel
Save