simplify!
This commit is contained in:
parent
a43053b7f9
commit
b9f7c3acfc
|
@ -73,7 +73,18 @@ public class JitsiMeetActivity extends FragmentActivity
|
|||
|
||||
@Override
|
||||
public void 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
|
||||
// Activity#onDestroy() called without warning. At this point we can try to leave the
|
||||
// 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 (AudioModeModule.useConnectionService()) {
|
||||
ConnectionService.abortConnections();
|
||||
}
|
||||
JitsiMeetOngoingConferenceService.abort(this);
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
@ -198,6 +209,8 @@ public class JitsiMeetActivity extends FragmentActivity
|
|||
@Override
|
||||
public void onConferenceJoined(Map<String, Object> data) {
|
||||
Log.d(TAG, "Conference joined: " + data);
|
||||
// Launch the service for the ongoing notification.
|
||||
JitsiMeetOngoingConferenceService.launch(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,6 +53,11 @@ public class JitsiMeetOngoingConferenceService extends Service
|
|||
}
|
||||
}
|
||||
|
||||
static void abort(Context context) {
|
||||
Intent intent = new Intent(context, JitsiMeetOngoingConferenceService.class);
|
||||
context.stopService(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.jitsi.meet.sdk;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -67,13 +65,13 @@ class OngoingConferenceTracker {
|
|||
switch(name) {
|
||||
case CONFERENCE_WILL_JOIN:
|
||||
currentConference = url;
|
||||
updateOnConferenceJoined();
|
||||
updateListeners();
|
||||
break;
|
||||
|
||||
case CONFERENCE_TERMINATED:
|
||||
if (url.equals(currentConference)) {
|
||||
currentConference = null;
|
||||
updateOnConferenceTerminated();
|
||||
updateListeners();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -87,20 +85,6 @@ class OngoingConferenceTracker {
|
|||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
private void updateOnConferenceJoined() {
|
||||
// Launch the service.
|
||||
Activity currentActivity = ReactInstanceManagerHolder.getCurrentActivity();
|
||||
if (currentActivity != null) {
|
||||
JitsiMeetOngoingConferenceService.launch(currentActivity);
|
||||
}
|
||||
|
||||
updateListeners();
|
||||
}
|
||||
|
||||
private void updateOnConferenceTerminated() {
|
||||
updateListeners();
|
||||
}
|
||||
|
||||
private void updateListeners() {
|
||||
for (OngoingConferenceListener listener : listeners) {
|
||||
listener.onCurrentConferenceChanged(currentConference);
|
||||
|
|
Loading…
Reference in New Issue