java/com/tailscale,cmd/tailscale: remove webview signin

Adjust the Custom Tabs browser color to match the app header while
here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/3/head
Elias Naur 4 years ago
parent a527c2abed
commit cd9c808dd2

@ -73,53 +73,16 @@ public class Peer extends Fragment {
} }
} }
public void showURLActionView(String url) { void showURL(String url) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
public void showURLCustomTabs(String url) {
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
int headerColor = 0xff496495;
builder.setToolbarColor(headerColor);
CustomTabsIntent intent = builder.build(); CustomTabsIntent intent = builder.build();
intent.launchUrl(getActivity(), Uri.parse(url)); intent.launchUrl(getActivity(), Uri.parse(url));
} }
public void showURLWebView(String url) {
DialogFragment f = new WebViewFragment();
Bundle args = new Bundle();
args.putString("url", url);
f.setArguments(args);
f.show(getFragmentManager(), "urldialog");
}
private native void fragmentCreated(); private native void fragmentCreated();
private native void fragmentDestroyed(); private native void fragmentDestroyed();
private native void onSignin(); private native void onSignin();
private native void onVPNPrepared(); private native void onVPNPrepared();
public static class WebViewFragment extends DialogFragment {
@Override public Dialog onCreateDialog(Bundle savedInstanceState) {
String url = getArguments().getString("url");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
WebView wv = new WebView(builder.getContext()) {
@Override public boolean onCheckIsTextEditor() {
// Force the soft keyboard to appear when a text
// input is focused.
return true;
}
};
wv.setFocusable(true);
wv.setFocusableInTouchMode(true);
wv.getSettings().setJavaScriptEnabled(true);
// Work around Google OAuth refusing to work in embedded
// browsers.
final String USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0";
wv.getSettings().setUserAgentString(USER_AGENT);
wv.setWebViewClient(new WebViewClient() {
});
wv.loadUrl(url);
return builder.setView(wv).create();
}
}
} }

@ -579,7 +579,7 @@ func (a *App) processUIEvents(w *app.Window, events []UIEvent, peer jni.Object,
func (a *App) browseToURL(peer jni.Object, url string) { func (a *App) browseToURL(peer jni.Object, url string) {
err := jni.Do(a.jvm, func(env jni.Env) error { err := jni.Do(a.jvm, func(env jni.Env) error {
jurl := jni.JavaString(env, url) jurl := jni.JavaString(env, url)
return a.callVoidMethod(peer, "showURLCustomTabs", "(Ljava/lang/String;)V", jni.Value(jurl)) return a.callVoidMethod(peer, "showURL", "(Ljava/lang/String;)V", jni.Value(jurl))
}) })
if err != nil { if err != nil {
fatalErr(err) fatalErr(err)

Loading…
Cancel
Save