Skip to content

Commit 79ee4a2

Browse files
committed
fix bug send callback to flutter
1 parent 0851d07 commit 79ee4a2

3 files changed

Lines changed: 43 additions & 44 deletions

File tree

android/src/main/java/com/stringee/stringeeflutterplugin/Call2Wrapper.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.stringee.common.StringeeAudioManager.AudioManagerEvents;
2222
import com.stringee.exception.StringeeError;
2323
import com.stringee.listener.StatusListener;
24-
import com.stringee.video.StringeeVideo;
2524
import com.stringee.video.StringeeVideo.ScalingType;
2625
import com.stringee.video.StringeeVideoTrack;
2726
import com.stringee.video.StringeeVideoTrack.MediaType;
@@ -199,14 +198,14 @@ public void answer(final Result result) {
199198
call2.answer(new StatusListener() {
200199
@Override
201200
public void onSuccess() {
202-
Log.d(TAG, "answer: success");
203-
Map map = new HashMap();
204-
map.put("status", true);
205-
map.put("code", 0);
206-
map.put("message", "Success");
207-
result.success(map);
208201
}
209202
});
203+
Log.d(TAG, "answer: success");
204+
Map map = new HashMap();
205+
map.put("status", true);
206+
map.put("code", 0);
207+
map.put("message", "Success");
208+
result.success(map);
210209
}
211210

212211
/**
@@ -224,15 +223,15 @@ public void hangup(final Result result) {
224223
call2.hangup(new StatusListener() {
225224
@Override
226225
public void onSuccess() {
227-
stringeeManager.getCall2sMap().put(call2.getCallId(), null);
228-
Log.d(TAG, "hangup: success");
229-
Map map = new HashMap();
230-
map.put("status", true);
231-
map.put("code", 0);
232-
map.put("message", "Success");
233-
result.success(map);
234226
}
235227
});
228+
stringeeManager.getCall2sMap().put(call2.getCallId(), null);
229+
Log.d(TAG, "hangup: success");
230+
Map map = new HashMap();
231+
map.put("status", true);
232+
map.put("code", 0);
233+
map.put("message", "Success");
234+
result.success(map);
236235
}
237236

238237
/**
@@ -250,15 +249,15 @@ public void reject(final Result result) {
250249
call2.reject(new StatusListener() {
251250
@Override
252251
public void onSuccess() {
253-
stringeeManager.getCall2sMap().put(call2.getCallId(), null);
254-
Log.d(TAG, "hangup: success");
255-
Map map = new HashMap();
256-
map.put("status", true);
257-
map.put("code", 0);
258-
map.put("message", "Success");
259-
result.success(map);
260252
}
261253
});
254+
stringeeManager.getCall2sMap().put(call2.getCallId(), null);
255+
Log.d(TAG, "hangup: success");
256+
Map map = new HashMap();
257+
map.put("status", true);
258+
map.put("code", 0);
259+
map.put("message", "Success");
260+
result.success(map);
262261
}
263262

264263
/**

android/src/main/java/com/stringee/stringeeflutterplugin/CallWrapper.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ public void answer(final Result result) {
189189
call.answer(new StatusListener() {
190190
@Override
191191
public void onSuccess() {
192-
Log.d(TAG, "answer: success");
193-
Map map = new HashMap();
194-
map.put("status", true);
195-
map.put("code", 0);
196-
map.put("message", "Success");
197-
result.success(map);
198192
}
199193
});
194+
Log.d(TAG, "answer: success");
195+
Map map = new HashMap();
196+
map.put("status", true);
197+
map.put("code", 0);
198+
map.put("message", "Success");
199+
result.success(map);
200200
}
201201

202202
/**
@@ -214,15 +214,15 @@ public void hangup(final Result result) {
214214
call.hangup(new StatusListener() {
215215
@Override
216216
public void onSuccess() {
217-
stringeeManager.getCallsMap().put(call.getCallId(), null);
218-
Log.d(TAG, "hangup: success");
219-
Map map = new HashMap();
220-
map.put("status", true);
221-
map.put("code", 0);
222-
map.put("message", "Success");
223-
result.success(map);
224217
}
225218
});
219+
stringeeManager.getCallsMap().put(call.getCallId(), null);
220+
Log.d(TAG, "hangup: success");
221+
Map map = new HashMap();
222+
map.put("status", true);
223+
map.put("code", 0);
224+
map.put("message", "Success");
225+
result.success(map);
226226
}
227227

228228
/**
@@ -240,15 +240,15 @@ public void reject(final Result result) {
240240
call.reject(new StatusListener() {
241241
@Override
242242
public void onSuccess() {
243-
stringeeManager.getCallsMap().put(call.getCallId(), null);
244-
Log.d(TAG, "reject: success");
245-
Map map = new HashMap();
246-
map.put("status", true);
247-
map.put("code", 0);
248-
map.put("message", "Success");
249-
result.success(map);
250243
}
251244
});
245+
stringeeManager.getCallsMap().put(call.getCallId(), null);
246+
Log.d(TAG, "reject: success");
247+
Map map = new HashMap();
248+
map.put("status", true);
249+
map.put("code", 0);
250+
map.put("message", "Success");
251+
result.success(map);
252252
}
253253

254254
/**
@@ -630,7 +630,7 @@ public void onSignalingStateChange(final StringeeCall stringeeCall, final String
630630
handler.post(new Runnable() {
631631
@Override
632632
public void run() {
633-
if (signalingState == SignalingState.CALLING) {
633+
if (signalingState == SignalingState.CALLING|| signalingState == SignalingState.RINGING) {
634634
Log.d(TAG, "makeCall: success");
635635
stringeeManager.getCallsMap().put(stringeeCall.getCallId(), CallWrapper.this);
636636
Map map = new HashMap();

android/src/main/java/com/stringee/stringeeflutterplugin/StringeeVideoView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void dispose() {
5858
}
5959

6060
private void renderView(final FrameLayout layout, final String callId, final Map<String, Object> creationParams) {
61-
StringeeManager.getInstance().getHandler().post(new Runnable() {
61+
StringeeManager.getInstance().getHandler().postDelayed(new Runnable() {
6262
@Override
6363
public void run() {
6464
CallWrapper call = StringeeManager.getInstance().getCallsMap().get(callId);
@@ -147,7 +147,7 @@ public void run() {
147147
StringeeManager.getInstance().getRemoteViewOptions().put(callId, remoteViewOptions);
148148
}
149149
}
150-
});
150+
},500);
151151
}
152152

153153
private void renderView(final Context context, final FrameLayout layout, final String trackId, final Map<String, Object> creationParams) {

0 commit comments

Comments
 (0)