[RN] Add the ability to set the default URL in the SDK
This commit is contained in:
parent
964061fa5c
commit
341e7e01aa
|
@ -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`
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
@property (nonatomic, nullable, weak) id<JitsiMeetViewDelegate> delegate;
|
||||
|
||||
@property (copy, nonatomic) NSURL *defaultURL;
|
||||
|
||||
@property (nonatomic) BOOL welcomePageEnabled;
|
||||
|
||||
+ (BOOL)application:(UIApplication *_Nonnull)application
|
||||
|
|
|
@ -231,6 +231,10 @@ static NSMapTable<NSString *, JitsiMeetView *> *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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue