Skip to content

Commit 9246cd8

Browse files
committed
Re-added manual proxy
1 parent 55a5609 commit 9246cd8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ dependencies {
136136
implementation "org.mozilla.components:concept-fetch:131.0.3"
137137
implementation "org.mozilla.components:lib-fetch-httpurlconnection:131.0.3"
138138

139+
// proxy support
140+
implementation "info.guardianproject.netcipher:netcipher-webkit:2.1.0"
141+
139142
// dependency injection
140143
final def daggerVersion = '2.48.1'
141144
implementation "com.google.dagger:dagger:$daggerVersion"

app/src/main/java/com/cookiegames/smartcookie/utils/ProxyUtils.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
package com.cookiegames.smartcookie.utils;
22

33
import android.app.Activity;
4-
import android.app.Dialog;
5-
import android.content.DialogInterface;
64
import android.util.Log;
75

86
import net.i2p.android.ui.I2PAndroidHelper;
97

10-
import java.util.ArrayList;
11-
import java.util.Arrays;
12-
import java.util.List;
13-
148
import javax.inject.Inject;
159
import javax.inject.Singleton;
1610

1711
import com.cookiegames.smartcookie.BrowserApp;
1812
import com.cookiegames.smartcookie.R;
1913
import com.cookiegames.smartcookie.browser.ProxyChoice;
20-
import com.cookiegames.smartcookie.dialog.BrowserDialog;
2114
import com.cookiegames.smartcookie.extensions.ActivityExtensions;
22-
import com.cookiegames.smartcookie.extensions.AlertDialogExtensionsKt;
2315
import com.cookiegames.smartcookie.preference.DeveloperPreferences;
2416
import com.cookiegames.smartcookie.preference.UserPreferences;
2517
import androidx.annotation.NonNull;
26-
import androidx.appcompat.app.AlertDialog;
27-
import kotlin.Pair;
28-
import kotlin.Unit;
18+
19+
import info.guardianproject.netcipher.webkit.WebkitProxy;
2920

3021
@Singleton
3122
public final class ProxyUtils {
@@ -92,6 +83,11 @@ private void initializeProxy(@NonNull Activity activity) {
9283
Log.d(TAG, "error enabling web proxying", e);
9384
}
9485

86+
try {
87+
WebkitProxy.setProxy(BrowserApp.class.getName(), activity.getApplicationContext(), null, host, port);
88+
} catch (Exception e) {
89+
Log.d(TAG, "error enabling web proxying", e);
90+
}
9591
}
9692

9793
public boolean isProxyReady(@NonNull Activity activity) {
@@ -113,6 +109,7 @@ public void updateProxySettings(@NonNull Activity activity) {
113109
initializeProxy(activity);
114110
} else {
115111
try {
112+
WebkitProxy.resetProxy(BrowserApp.class.getName(), activity.getApplicationContext());
116113
} catch (Exception e) {
117114
Log.e(TAG, "Unable to reset proxy", e);
118115
}

0 commit comments

Comments
 (0)