fix(android) fix joining meetings in quick succession

If the readyToClose event was fired there is no need to "leave" the
meeting, it just circles back to the app unnecessarily, potentially
creating another readyToClose event.
pull/15039/head jitsi-meet_9691
Saúl Ibarra Corretgé 9 months ago committed by Calinteodor
parent d6fa066e4d
commit 73c836fafb
  1. 16
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java

@ -54,6 +54,8 @@ public class JitsiMeetActivity extends AppCompatActivity
private static final String ACTION_JITSI_MEET_CONFERENCE = "org.jitsi.meet.CONFERENCE";
private static final String JITSI_MEET_CONFERENCE_OPTIONS = "JitsiMeetConferenceOptions";
private boolean isReadyToClose;
private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@ -124,6 +126,8 @@ public class JitsiMeetActivity extends AppCompatActivity
@Override
public void onDestroy() {
JitsiMeetLogger.i("onDestroy()");
// Here we are trying to handle the following corner case: an application using the SDK
// is using this Activity for displaying meetings, but there is another "main" Activity
// with other content. If this Activity is "swiped out" from the recent list we will get
@ -131,7 +135,10 @@ public class JitsiMeetActivity extends AppCompatActivity
// current meeting, but when our view is detached from React the JS <-> Native bridge won't
// be operational so the external API won't be able to notify the native side that the
// conference terminated. Thus, try our best to clean up.
leave();
if (!isReadyToClose) {
JitsiMeetLogger.i("onDestroy(): leaving...");
leave();
}
this.jitsiView = null;
@ -149,8 +156,12 @@ public class JitsiMeetActivity extends AppCompatActivity
@Override
public void finish() {
leave();
if (!isReadyToClose) {
JitsiMeetLogger.i("finish(): leaving...");
leave();
}
JitsiMeetLogger.i("finish(): finishing...");
super.finish();
}
@ -252,6 +263,7 @@ public class JitsiMeetActivity extends AppCompatActivity
protected void onReadyToClose() {
JitsiMeetLogger.i("SDK is ready to close");
isReadyToClose = true;
finish();
}

Loading…
Cancel
Save