Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

android: add initial implementation of join / leave

Saúl Ibarra Corretgé56135bd08578
diff --git a/android/app/src/main/java/org/jitsi/meet/MainActivity.java b/android/app/src/main/java/org/jitsi/meet/MainActivity.java
index 2f4b19290b..92345f58a0 100644
--- a/android/app/src/main/java/org/jitsi/meet/MainActivity.java
+++ b/android/app/src/main/java/org/jitsi/meet/MainActivity.java
@@ -58,7 +58,7 @@ public class MainActivity extends FragmentActivity implements JitsiMeetActivityI
private void initialize() {
JitsiMeetFragment fragment = getFragment();
fragment.setWelcomePageEnabled(true);
- fragment.loadURL(getIntentUrl(getIntent()));
+ fragment.getJitsiView().join(getIntentUrl(getIntent()));
}
private @Nullable String getIntentUrl(Intent intent) {
@@ -113,7 +113,7 @@ public class MainActivity extends FragmentActivity implements JitsiMeetActivityI
String url;
if ((url = getIntentUrl(intent)) != null) {
- getFragment().loadURL(url);
+ getFragment().getJitsiView().join(url);
return;
}
@@ -145,7 +145,7 @@ public class MainActivity extends FragmentActivity implements JitsiMeetActivityI
}
if (dynamicLink != null) {
- getFragment().loadURL(dynamicLink.toString());
+ getFragment().getJitsiView().join(dynamicLink.toString());
}
});
}
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java
index a5c2fa0638..c432aa5d6d 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetFragment.java
@@ -107,6 +107,10 @@ public class JitsiMeetFragment extends Fragment {
return view;
}
+ public JitsiMeetView getJitsiView() {
+ return view;
+ }
+
/**
*
* @see JitsiMeetView#isPictureInPictureEnabled()
@@ -126,16 +130,6 @@ public class JitsiMeetFragment extends Fragment {
return view == null ? welcomePageEnabled : view.isWelcomePageEnabled();
}
- /**
- * Loads the given URL and displays the conference. If the specified URL is
- * null, the welcome page is displayed instead.
- *
- * @param url The conference URL.
- */
- public void loadURL(@Nullable String url) {
- view.loadURLString(url);
- }
-
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
JitsiMeetActivityDelegate.onActivityResult(
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
index 7734bf75ab..2ec22587a1 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
@@ -1,5 +1,6 @@
/*
- * Copyright @ 2017-present Atlassian Pty Ltd
+ * Copyright @ 2018-present 8x8, Inc.
+ * Copyright @ 2017-2018 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,31 +45,6 @@ public class JitsiMeetView
*/
private static final String TAG = JitsiMeetView.class.getSimpleName();
- /**
- * Loads a specific URL {@code String} in all existing
- * {@code JitsiMeetView}s.
- *
- * @param urlString he URL {@code String} to load in all existing
- * {@code JitsiMeetView}s.
- * @return If the specified {@code urlString} was submitted for loading in
- * at least one {@code JitsiMeetView}, then {@code true}; otherwise,
- * {@code false}.
- */
- public static boolean loadURLStringInViews(String urlString) {
- boolean loaded = false;
-
- synchronized (views) {
- for (BaseReactView view : views) {
- if (view instanceof JitsiMeetView) {
- ((JitsiMeetView)view).loadURLString(urlString);
- loaded = true;
- }
- }
- }
-
- return loaded;
- }
-
/**
* A color scheme object to override the default color is the SDK.
*/
@@ -197,16 +173,20 @@ public class JitsiMeetView
return welcomePageEnabled;
}
- /**
- * Loads a specific {@link URL} which may identify a conference to join. If
- * the specified {@code URL} is {@code null} and the Welcome page is
- * enabled, the Welcome page is displayed instead.
- *
- * @param url The {@code URL} to load which may identify a conference to
- * join.
- */
- public void loadURL(@Nullable URL url) {
- loadURLString(url == null ? null : url.toString());
+ public void join(@Nullable String url) {
+ Bundle urlObject;
+
+ if (url == null) {
+ urlObject = null;
+ } else {
+ urlObject = new Bundle();
+ urlObject.putString("url", url);
+ }
+ loadURL(urlObject);
+ }
+
+ public void leave() {
+ loadURL(null);
}
/**
@@ -219,7 +199,7 @@ public class JitsiMeetView
*
* @param urlObject The URL to load which may identify a conference to join.
*/
- public void loadURLObject(@Nullable Bundle urlObject) {
+ private void loadURL(@Nullable Bundle urlObject) {
Bundle props = new Bundle();
// color scheme
@@ -259,26 +239,6 @@ public class JitsiMeetView
createReactRootView("App", props);
}
- /**
- * Loads a specific URL {@link String} which may identify a conference to
- * join. If the specified URL {@code String} is {@code null} and the Welcome
- * page is enabled, the Welcome page is displayed instead.
- *
- * @param urlString The URL {@code String} to load which may identify a
- * conference to join.
- */
- public void loadURLString(@Nullable String urlString) {
- Bundle urlObject;
-
- if (urlString == null) {
- urlObject = null;
- } else {
- urlObject = new Bundle();
- urlObject.putString("url", urlString);
- }
- loadURLObject(urlObject);
- }
-
/**
* The internal processing for the URL of the current conference set on the
* associated {@link JitsiMeetView}.