2.3.5+4
This commit is contained in:
parent
9df556b837
commit
4d8ba65f9b
@ -1,5 +1,6 @@
|
||||
package io.openim.flutter_openim_sdk;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -9,6 +10,8 @@ import java.lang.reflect.Method;
|
||||
|
||||
import io.flutter.Log;
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin;
|
||||
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
|
||||
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
|
||||
@ -27,12 +30,12 @@ import io.openim.flutter_openim_sdk.manager.WorkMomentsManager;
|
||||
/**
|
||||
* FlutterOpenimSdkPlugin
|
||||
*/
|
||||
public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler {
|
||||
public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler, ActivityAware {
|
||||
/// The MethodChannel that will the communication between Flutter and native Android
|
||||
///
|
||||
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
|
||||
/// when the Flutter Engine is detached from the Activity
|
||||
|
||||
private static final String CHANNEL_NAME = "flutter_openim_sdk";
|
||||
public static MethodChannel channel;
|
||||
private static IMManager imManager;
|
||||
private static UserManager userManager;
|
||||
@ -43,11 +46,11 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
|
||||
private static SignalingManager signalingManager;
|
||||
private static WorkMomentsManager workMomentsManager;
|
||||
private static OrganizationManager organizationManager;
|
||||
private static Activity activity;
|
||||
private static Context context;
|
||||
|
||||
|
||||
public FlutterOpenimSdkPlugin() {
|
||||
}
|
||||
|
||||
private FlutterOpenimSdkPlugin(Context context) {
|
||||
FlutterOpenimSdkPlugin.imManager = new IMManager();
|
||||
FlutterOpenimSdkPlugin.userManager = new UserManager();
|
||||
FlutterOpenimSdkPlugin.friendshipManager = new FriendshipManager();
|
||||
@ -59,11 +62,12 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
|
||||
FlutterOpenimSdkPlugin.organizationManager = new OrganizationManager();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
|
||||
FlutterOpenimSdkPlugin.channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_openim_sdk");
|
||||
FlutterOpenimSdkPlugin.channel.setMethodCallHandler(new FlutterOpenimSdkPlugin(flutterPluginBinding.getApplicationContext()));
|
||||
// channel.setMethodCallHandler(this);
|
||||
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), CHANNEL_NAME);
|
||||
context = flutterPluginBinding.getApplicationContext();
|
||||
channel.setMethodCallHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,6 +80,28 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
|
||||
FlutterOpenimSdkPlugin.channel.setMethodCallHandler(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
|
||||
activity = binding.getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromActivityForConfigChanges() {
|
||||
activity = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
|
||||
activity = binding.getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromActivity() {
|
||||
activity = null;
|
||||
}
|
||||
|
||||
|
||||
void parse(@NonNull MethodCall call, @NonNull Result result) {
|
||||
try {
|
||||
String managerName = call.argument("ManagerName");
|
||||
|
@ -5,6 +5,10 @@ class MessageFailedCode {
|
||||
|
||||
/// 被对方删除
|
||||
static const int deletedByFriend = 601;
|
||||
|
||||
/// 已被移除群聊/群已解散
|
||||
static const int notInGroup = 302;
|
||||
|
||||
}
|
||||
|
||||
/// 添加好友失败
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OpenIM {
|
||||
static const version = '2.3.5+3';
|
||||
static const version = '2.3.5+4';
|
||||
|
||||
static const _channel = const MethodChannel('flutter_openim_sdk');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user