[RN] Increase the coverage of JitsiMeetViewListener
JitsiMeetViewListener is an integral part of the public API of Jitsi Meet SDK for Android. Utilize it in the Debug configuration of the Jitsi Meet app for Android in order to increase (1) awareness of API breakages and (2) API coverage. The same goes for JitsiMeetViewDelegate in Jitsi Meet SDK and app for iOS.
This commit is contained in:
parent
67edaac1c9
commit
4dc78ce458
|
@ -17,8 +17,13 @@
|
|||
package org.jitsi.meet;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import org.jitsi.meet.sdk.JitsiMeetActivity;
|
||||
import org.jitsi.meet.sdk.JitsiMeetView;
|
||||
import org.jitsi.meet.sdk.JitsiMeetViewListener;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The one and only {@link Activity} that the Jitsi Meet app needs. The
|
||||
|
@ -33,6 +38,80 @@ import org.jitsi.meet.sdk.JitsiMeetActivity;
|
|||
* {@code react-native run-android}.
|
||||
*/
|
||||
public class MainActivity extends JitsiMeetActivity {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected JitsiMeetView initializeView() {
|
||||
JitsiMeetView view = super.initializeView();
|
||||
|
||||
// XXX In order to increase (1) awareness of API breakages and (2) API
|
||||
// coverage, utilize JitsiMeetViewListener in the Debug configuration of
|
||||
// the app.
|
||||
if (BuildConfig.DEBUG && view != null) {
|
||||
view.setListener(new JitsiMeetViewListener() {
|
||||
private void on(String name, Map<String, Object> data) {
|
||||
// Log with the tag "ReactNative" in order to have the log
|
||||
// visible in react-native log-android as well.
|
||||
Log.d(
|
||||
"ReactNative",
|
||||
JitsiMeetViewListener.class.getSimpleName() + " "
|
||||
+ name + " "
|
||||
+ data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceFailed(Map<String, Object> data) {
|
||||
on("CONFERENCE_FAILED", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceJoined(Map<String, Object> data) {
|
||||
on("CONFERENCE_JOINED", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceLeft(Map<String, Object> data) {
|
||||
on("CONFERENCE_LEFT", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceWillJoin(Map<String, Object> data) {
|
||||
on("CONFERENCE_WILL_JOIN", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onConferenceWillLeave(Map<String, Object> data) {
|
||||
on("CONFERENCE_WILL_LEAVE", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onLoadConfigError(Map<String, Object> data) {
|
||||
on("LOAD_CONFIG_ERROR", data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -76,8 +76,22 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
* Initializes the {@link #view} of this {@code JitsiMeetActivity} with a
|
||||
* new {@link JitsiMeetView} instance.
|
||||
*/
|
||||
private void initializeView() {
|
||||
view = new JitsiMeetView(this);
|
||||
private void initializeContentView() {
|
||||
JitsiMeetView view = initializeView();
|
||||
|
||||
if (view != null) {
|
||||
this.view = view;
|
||||
setContentView(this.view);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new {@link JitsiMeetView} instance.
|
||||
*
|
||||
* @return a new {@code JitsiMeetView} instance.
|
||||
*/
|
||||
protected JitsiMeetView initializeView() {
|
||||
JitsiMeetView view = new JitsiMeetView(this);
|
||||
|
||||
// In order to have the desired effect
|
||||
// JitsiMeetView#setWelcomePageEnabled(boolean) must be invoked before
|
||||
|
@ -85,7 +99,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
view.setWelcomePageEnabled(welcomePageEnabled);
|
||||
view.loadURL(null);
|
||||
|
||||
setContentView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,7 +123,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
if (requestCode == OVERLAY_PERMISSION_REQUEST_CODE
|
||||
&& canRequestOverlayPermission()) {
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
initializeView();
|
||||
initializeContentView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +158,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
|||
return;
|
||||
}
|
||||
|
||||
initializeView();
|
||||
initializeContentView();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,4 +40,38 @@
|
|||
[view loadURL:nil];
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
||||
void _onJitsiMeetViewDelegateEvent(NSString *name, NSDictionary *data) {
|
||||
NSLog(
|
||||
@"[%s:%d] JitsiMeetViewDelegate %@ %@",
|
||||
__FILE__, __LINE__, name, data);
|
||||
}
|
||||
|
||||
- (void)conferenceFailed:(NSDictionary *)data {
|
||||
_onJitsiMeetViewDelegateEvent(@"CONFERENCE_FAILED", data);
|
||||
}
|
||||
|
||||
- (void)conferenceJoined:(NSDictionary *)data {
|
||||
_onJitsiMeetViewDelegateEvent(@"CONFERENCE_JOINED", data);
|
||||
}
|
||||
|
||||
- (void)conferenceLeft:(NSDictionary *)data {
|
||||
_onJitsiMeetViewDelegateEvent(@"CONFERENCE_LEFT", data);
|
||||
}
|
||||
|
||||
- (void)conferenceWillJoin:(NSDictionary *)data {
|
||||
_onJitsiMeetViewDelegateEvent(@"CONFERENCE_WILL_JOIN", data);
|
||||
}
|
||||
|
||||
- (void)conferenceWillLeave:(NSDictionary *)data {
|
||||
_onJitsiMeetViewDelegateEvent(@"CONFERENCE_WILL_LEAVE", data);
|
||||
}
|
||||
|
||||
- (void)loadConfigError:(NSDictionary *)data {
|
||||
_onJitsiMeetViewDelegateEvent(@"LOAD_CONFIG_ERROR", data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue