File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
android/src/main/java/com/cloudwebrtc/webrtc/utils Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .cloudwebrtc .webrtc .utils ;
2
+
3
+ import android .os .Looper ;
4
+ import android .os .Handler ;
5
+
6
+ import io .flutter .plugin .common .MethodChannel ;
7
+
8
+ public final class AnyThreadResult implements MethodChannel .Result {
9
+ final private MethodChannel .Result result ;
10
+
11
+ public AnyThreadResult (MethodChannel .Result result ) {
12
+ this .result = result ;
13
+ }
14
+
15
+ @ Override
16
+ public void success (Object o ) {
17
+ final Handler handler = new Handler (Looper .getMainLooper ());
18
+ handler .post (()->result .success (o ));
19
+ }
20
+
21
+ @ Override
22
+ public void error (String s , String s1 , Object o ) {
23
+ final Handler handler = new Handler (Looper .getMainLooper ());
24
+ handler .post (()->result .error (s , s1 , o ));
25
+ }
26
+
27
+ @ Override
28
+ public void notImplemented () {
29
+ final Handler handler = new Handler (Looper .getMainLooper ());
30
+ handler .post (result ::notImplemented );
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments