diff --git a/android/README.md b/android/README.md index 7c3130fb0..ce39dcf99 100644 --- a/android/README.md +++ b/android/README.md @@ -105,6 +105,10 @@ public class MainActivity extends AppCompatActivity { This class encapsulates a high level API in the form of an Android `Activity` which displays a single `JitsiMeetView`. +#### getDefaultURL() + +See JitsiMeetView.getDefaultURL. + #### getWelcomePageEnabled() See JitsiMeetView.getWelcomePageEnabled. @@ -113,6 +117,10 @@ See JitsiMeetView.getWelcomePageEnabled. See JitsiMeetView.loadURL. +#### setDefaultURL(URL) + +See JitsiMeetView.setDefaultURL. + #### setWelcomePageEnabled(boolean) See JitsiMeetView.setWelcomePageEnabled. @@ -128,6 +136,12 @@ Releases all resources associated with this view. This method MUST be called when the Activity holding this view is going to be destroyed, usually in the `onDestroy()` method. +#### getDefaultURL() + +Returns the default URL for joining a conference when a non-full URL is given, +or null if it's not set. If not set, the builtin default (in JavaScript) is +used: https://meet.jit.si. + #### getListener() Returns the `JitsiMeetViewListener` instance attached to the view. @@ -169,6 +183,12 @@ urlBundle.putString("url", "https://meet.jit.si/Test123"); view.loadURLObject(urlBundle); ``` +#### setDefaultURL(URL) + +Sets the default URL. See `getDefaultURL` for more information. + +NOTE: Must be called before `loadURL`/`loadURLString` for it to take effect. + #### setListener(listener) Sets the given listener (class implementing the `JitsiMeetViewListener` diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java index 453557e7a..eddb2943d 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java @@ -60,6 +60,12 @@ public class JitsiMeetActivity */ private JitsiMeetView view; + /** + * Default URL to be used when joining a conference. The value is used only + * while {@link #view} equals {@code null}. + */ + private URL defaultURL; + /** * Whether the Welcome page is enabled. The value is used only while * {@link #view} equals {@code null}. @@ -74,6 +80,14 @@ public class JitsiMeetActivity >= Build.VERSION_CODES.M; } + /** + * + * @see JitsiMeetView#getDefaultURL + */ + public URL getDefaultURL() { + return view == null ? defaultURL : view.getDefaultURL(); + } + /** * * @see JitsiMeetView#getWelcomePageEnabled @@ -104,8 +118,10 @@ public class JitsiMeetActivity JitsiMeetView view = new JitsiMeetView(this); // In order to have the desired effect - // JitsiMeetView#setWelcomePageEnabled(boolean) must be invoked before + // JitsiMeetView#setWelcomePageEnabled(boolean) or + // JitsiMeetView#setDefaultURL(URL) must be invoked before // JitsiMeetView#loadURL(URL). + view.setDefaultURL(defaultURL); view.setWelcomePageEnabled(welcomePageEnabled); view.loadURL(null); @@ -225,6 +241,18 @@ public class JitsiMeetActivity JitsiMeetView.onHostResume(this, defaultBackButtonImpl); } + /** + * + * @see JitsiMeetView#setDefaultURL + */ + public void setDefaultURL(URL url) { + if (view == null) { + defaultURL = url; + } else { + view.setDefaultURL(url); + } + } + /** * * @see JitsiMeetView#setWelcomePageEnabled 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 0a25f929b..abfec91ac 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 @@ -236,6 +236,11 @@ public class JitsiMeetView extends FrameLayout { } } + /** + * Default base URL to use when joining a conference without a full URL. + */ + private URL defaultURL; + /** * The unique identifier of this {@code JitsiMeetView} within the process * for the purposes of {@link ExternalAPI}. The name scope was inspired by @@ -291,6 +296,17 @@ public class JitsiMeetView extends FrameLayout { } } + /** + * Gets the default base URL. If set, it will be preferred over the builtin + * default (https://meet.jit.si) in JavaScript. When set, it will be used + * to compose the full URL for a conference, when no full URL is provided. + * + * @return {@URL} the default URL or {@null} if none was set. + */ + public URL getDefaultURL() { + return defaultURL; + } + /** * Gets the {@link JitsiMeetViewListener} set on this {@code JitsiMeetView}. * @@ -338,6 +354,10 @@ public class JitsiMeetView extends FrameLayout { public void loadURLObject(@Nullable Bundle urlObject) { Bundle props = new Bundle(); + // defaultURL + if (defaultURL != null) { + props.putString("defaultURL", defaultURL.toString()); + } // externalAPIScope props.putString("externalAPIScope", externalAPIScope); // url @@ -377,6 +397,16 @@ public class JitsiMeetView extends FrameLayout { loadURLObject(urlObject); } + /** + * Sets the default base URL. Must be called before {@link #loadURL(URL)} + * for it to take effect. + * + * @param url - The {@URL} to be set as the new default URL. + */ + public void setDefaultURL(URL url) { + defaultURL = url; + } + /** * Sets a specific {@link JitsiMeetViewListener} on this * {@code JitsiMeetView}. diff --git a/ios/README.md b/ios/README.md index 8922d03ab..15bd11894 100644 --- a/ios/README.md +++ b/ios/README.md @@ -46,6 +46,14 @@ The `JitsiMeetView` class is the entry point to the SDK. It a subclass of Property for getting / setting the `JitsiMeetViewDelegate` on `JitsiMeetView`. +#### defaultURL + +Property for getting / setting the base default URL. The default URL is used for +joining a conference when a non-full URL is given. If not set (or nil), the +builtin default (in JavaScript) is used: https://meet.jit.si. + +NOTE: Must be set before `loadURL:`/`loadURLString:` for it to take effect. + #### welcomePageEnabled Property for getting / setting whether the Welcome page is enabled. If NO, a diff --git a/ios/sdk/src/JitsiMeetView.h b/ios/sdk/src/JitsiMeetView.h index f328d8f44..6af9e7723 100644 --- a/ios/sdk/src/JitsiMeetView.h +++ b/ios/sdk/src/JitsiMeetView.h @@ -23,6 +23,8 @@ @property (nonatomic, nullable, weak) id delegate; +@property (copy, nonatomic) NSURL *defaultURL; + @property (nonatomic) BOOL welcomePageEnabled; + (BOOL)application:(UIApplication *_Nonnull)application diff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.m index 0e0985da8..f5d381bf1 100644 --- a/ios/sdk/src/JitsiMeetView.m +++ b/ios/sdk/src/JitsiMeetView.m @@ -231,6 +231,10 @@ static NSMapTable *views; - (void)loadURLObject:(NSDictionary *)urlObject { NSMutableDictionary *props = [[NSMutableDictionary alloc] init]; + if (self.defaultURL) { + props[@"defaultURL"] = [self.defaultURL absoluteString]; + } + props[@"externalAPIScope"] = externalAPIScope; props[@"welcomePageEnabled"] = @(self.welcomePageEnabled);