fix bug
This commit is contained in:
parent
3f7f94efeb
commit
b82f966cb5
@ -28,12 +28,7 @@ public class CommonUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void runMainThreadReturn(final MethodChannel.Result result, final Object param) {
|
public static void runMainThreadReturn(final MethodChannel.Result result, final Object param) {
|
||||||
MAIN_HANDLER.post(new Runnable() {
|
MAIN_HANDLER.post(() -> result.success(param));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
result.success(param);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runMainThread(Runnable runnable) {
|
public static void runMainThread(Runnable runnable) {
|
||||||
@ -42,12 +37,7 @@ public class CommonUtil {
|
|||||||
|
|
||||||
|
|
||||||
public static void runMainThreadReturnError(final MethodChannel.Result result, final String errorCode, final String errorMessage, final Object errorDetails) {
|
public static void runMainThreadReturnError(final MethodChannel.Result result, final String errorCode, final String errorMessage, final Object errorDetails) {
|
||||||
MAIN_HANDLER.post(new Runnable() {
|
MAIN_HANDLER.post(() -> result.error(errorCode, errorMessage, errorDetails));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
result.error(errorCode, errorMessage, errorDetails);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runMainThreadReturnError(final MethodChannel.Result result, final long errorCode, final String errorMessage, final Object errorDetails) {
|
public static void runMainThreadReturnError(final MethodChannel.Result result, final long errorCode, final String errorMessage, final Object errorDetails) {
|
||||||
@ -55,13 +45,11 @@ public class CommonUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static <T> void emitEvent(String method, String type, Long errCode, String errMsg, T data) {
|
public synchronized static <T> void emitEvent(String method, String type, Long errCode, String errMsg, T data) {
|
||||||
runMainThread(new Runnable() {
|
runMainThread(() -> {
|
||||||
@Override
|
HashMap<String, Object> res = new HashMap<>();
|
||||||
public void run() {
|
if (null != type) {
|
||||||
HashMap<String, Object> res = new HashMap<String, Object>();
|
|
||||||
// if (null != type) {
|
|
||||||
res.put("type", type);
|
res.put("type", type);
|
||||||
// }
|
}
|
||||||
if (null != data) {
|
if (null != data) {
|
||||||
res.put("data", data);
|
res.put("data", data);
|
||||||
}
|
}
|
||||||
@ -73,7 +61,6 @@ public class CommonUtil {
|
|||||||
}
|
}
|
||||||
Log.i("F-OpenIMSDK(native call flutter)", "{ method:" + method + ", type:" + type + " }");
|
Log.i("F-OpenIMSDK(native call flutter)", "{ method:" + method + ", type:" + type + " }");
|
||||||
FlutterOpenimSdkPlugin.channel.invokeMethod(method, res);
|
FlutterOpenimSdkPlugin.channel.invokeMethod(method, res);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user