Skip to content
Snippets Groups Projects
Verified Commit d980086a authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Temporary changes to about:torconnect for Android.

Temporary message to open Android settings from about:torconnect
parent 7cb6472f
Branches
Tags
2 merge requests!898Bug 42252: Add further support for TorController in firefox-android,!878Bug 42251: Wired TorConnect status updates
......@@ -50,6 +50,7 @@ public class TorIntegrationAndroid implements BundleEventListener {
private static final String EVENT_BOOTSTRAP_PROGRESS = "GeckoView:Tor:BootstrapProgress";
private static final String EVENT_BOOTSTRAP_COMPLETE = "GeckoView:Tor:BootstrapComplete";
private static final String EVENT_BOOTSTRAP_ERROR = "GeckoView:Tor:BootstrapError";
private static final String EVENT_SETTINGS_OPEN = "GeckoView:Tor:OpenSettings";
// Events we emit
private static final String EVENT_SETTINGS_GET = "GeckoView:Tor:SettingsGet";
......@@ -114,7 +115,8 @@ public class TorIntegrationAndroid implements BundleEventListener {
EVENT_BOOTSTRAP_STATE_CHANGED,
EVENT_BOOTSTRAP_PROGRESS,
EVENT_BOOTSTRAP_COMPLETE,
EVENT_BOOTSTRAP_ERROR);
EVENT_BOOTSTRAP_ERROR,
EVENT_SETTINGS_OPEN);
}
@Override // BundleEventListener
......@@ -152,6 +154,10 @@ public class TorIntegrationAndroid implements BundleEventListener {
for (BootstrapStateChangeListener listener: mBootstrapStateListeners) {
listener.onBootstrapError(msg, details);
}
} else if (EVENT_SETTINGS_OPEN.equals(event)) {
for (BootstrapStateChangeListener listener: mBootstrapStateListeners) {
listener.onSettingsRequested();
}
}
}
......@@ -502,6 +508,7 @@ public class TorIntegrationAndroid implements BundleEventListener {
void onBootstrapProgress(double progress, String status, boolean hasWarnings);
void onBootstrapComplete();
void onBootstrapError(String message, String details);
void onSettingsRequested();
}
public @NonNull GeckoResult<GeckoBundle> getSettings() {
......
......
......@@ -7,6 +7,7 @@ import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
EventDispatcher: "resource://gre/modules/Messaging.sys.mjs",
MoatRPC: "resource://gre/modules/Moat.sys.mjs",
TorBootstrapRequest: "resource://gre/modules/TorBootstrapRequest.sys.mjs",
});
......@@ -1092,6 +1093,12 @@ export const TorConnect = (() => {
Further external commands and helper methods
*/
openTorPreferences() {
if (TorLauncherUtil.isAndroid) {
lazy.EventDispatcher.instance.sendRequest({
type: "GeckoView:Tor:OpenSettings",
});
return;
}
const win = lazy.BrowserWindowTracker.getTopWindow();
win.switchToTabHavingURI("about:preferences#connection", true);
},
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment