[Android] Use loadURL in the app
This commit is contained in:
parent
6b2a93909b
commit
1ad8436cb5
|
@ -20,6 +20,7 @@ import android.app.Activity;
|
|||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -53,11 +54,13 @@ public class JitsiMeetView extends FrameLayout {
|
|||
|
||||
public static JitsiMeetView findViewByExternalAPIScope(
|
||||
String externalAPIScope) {
|
||||
synchronized (views) {
|
||||
for (JitsiMeetView view : views) {
|
||||
if (view.externalAPIScope.equals(externalAPIScope)) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -91,6 +94,30 @@ public class JitsiMeetView extends FrameLayout {
|
|||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a specific URL {@code String} in all existing
|
||||
* {@code JitsiMeetView}s.
|
||||
*
|
||||
* @param urlString - The 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}.
|
||||
*/
|
||||
private static boolean loadURLStringInViews(String urlString) {
|
||||
synchronized (views) {
|
||||
if (!views.isEmpty()) {
|
||||
for (JitsiMeetView view : views) {
|
||||
view.loadURLString(urlString);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activity lifecycle method which should be called from
|
||||
* <tt>Activity.onBackPressed</tt> so we can do the required internal
|
||||
|
@ -156,6 +183,19 @@ public class JitsiMeetView extends FrameLayout {
|
|||
* @param intent - <tt>Intent</tt> instance which was received.
|
||||
*/
|
||||
public static void onNewIntent(Intent intent) {
|
||||
// XXX At least twice we received bug reports about malfunctioning
|
||||
// loadURL in the Jitsi Meet SDK while the Jitsi Meet app seemed to
|
||||
// functioning as expected in our testing. But that was to be expected
|
||||
// because the app does not exercise loadURL. In order to increase the
|
||||
// test coverage of loadURL, channel deep linking through loadURL.
|
||||
Uri uri;
|
||||
|
||||
if (Intent.ACTION_VIEW.equals(intent.getAction())
|
||||
&& (uri = intent.getData()) != null
|
||||
&& loadURLStringInViews(uri.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (reactInstanceManager != null) {
|
||||
reactInstanceManager.onNewIntent(intent);
|
||||
}
|
||||
|
@ -196,8 +236,10 @@ public class JitsiMeetView extends FrameLayout {
|
|||
|
||||
// Hook this JitsiMeetView into ExternalAPI.
|
||||
externalAPIScope = UUID.randomUUID().toString();
|
||||
synchronized (views) {
|
||||
views.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases the React resources (specifically the {@link ReactRootView})
|
||||
|
|
|
@ -269,6 +269,14 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
|
|||
|
||||
#pragma mark Private methods
|
||||
|
||||
/**
|
||||
* Loads a specific {@link NSURL} in all existing {@code JitsiMeetView}s.
|
||||
*
|
||||
* @param url - The {@code NSURL} to load in all existing
|
||||
* {@code JitsiMeetView}s.
|
||||
* @return {@code YES} if the specified {@code url} was submitted for loading
|
||||
* in at least one {@code JitsiMeetView}; otherwise, {@code NO}.
|
||||
*/
|
||||
+ (BOOL)loadURLInViews:(NSURL *)url {
|
||||
BOOL handled = NO;
|
||||
|
||||
|
|
Loading…
Reference in New Issue