Verified Commit 3398c106 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! Temporary changes to about:torconnect for Android.

Temporary message to open Android settings from about:torconnect
parent d6184984
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -51,6 +51,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";
@@ -115,7 +116,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
@@ -157,6 +159,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();
            }
        }
    }

@@ -517,6 +523,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 −0
Original line number Diff line number Diff line
@@ -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",
});
@@ -1091,6 +1092,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);
    },