Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to use Tor #207

Merged
merged 2 commits into from Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/build.gradle
Expand Up @@ -5,7 +5,7 @@ android {
buildToolsVersion "24.0.1"

defaultConfig {
applicationId "org.indywidualni.fblite"
applicationId "org.indywidualni.fblite.debug"
minSdkVersion 15
targetSdkVersion 24
versionCode 43
Expand All @@ -25,9 +25,10 @@ android {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'org.jsoup:jsoup:1.9.2'
compile 'ch.acra:acra:4.9.0'
compile 'com.github.johnkil.android-appmsg:appmsg:1.2.0'
compile 'info.guardianproject.netcipher:netcipher:1.2.1'
}
4 changes: 4 additions & 0 deletions app/proguard-rules.pro
Expand Up @@ -13,3 +13,7 @@

# jsoup library
-keeppackagenames org.jsoup.nodes

# StrongHttpsClient and its support classes are totally unused, so the
# ch.boye.httpclientandroidlib.** classes are also unneeded
-dontwarn info.guardianproject.netcipher.client.*
Expand Up @@ -66,6 +66,8 @@
import java.text.DateFormat;
import java.util.Date;

import info.guardianproject.netcipher.web.WebkitProxy;

@SuppressWarnings("UnusedDeclaration")
public class MainActivity extends Activity {

Expand Down Expand Up @@ -252,6 +254,15 @@ else if (preferences.getBoolean("basic_mode", false))
}
}

// Tor proxy
if (preferences.getBoolean("use_tor", false)) {
try {
WebkitProxy.setProxy("org.indywidualni.fblite.MyApplication", getApplicationContext(), webView, "localhost", 8118);
} catch (Exception e) {
Log.w(TAG, "Failed to set webview proxy", e);
}
}

// since API 18 cache quota is managed automatically
if (Build.VERSION.SDK_INT < 18) {
//noinspection deprecation
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -166,5 +166,7 @@
<string name="confirm_exit">Confirm exiting the app</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="use_tor_title">Use Tor &#8635;</string>
<string name="use_tor_summary">Force all traffic through Tor for increased privacy. Requires Orbot.</string>

</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/xml-v21/preferences.xml
Expand Up @@ -114,6 +114,12 @@
android:summary="@string/load_extra_description"
android:defaultValue="false"/>

<SwitchPreference
android:key="use_tor"
android:title="@string/use_tor_title"
android:summary="@string/use_tor_summary"
android:defaultValue="false"/>

<SwitchPreference
android:key="app_updates"
android:title="@string/check_for_updates"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/preferences.xml
Expand Up @@ -114,6 +114,12 @@
android:summary="@string/load_extra_description"
android:defaultValue="false"/>

<CheckBoxPreference
android:key="use_tor"
android:title="@string/use_tor_title"
android:summary="@string/use_tor_summary"
android:defaultValue="false"/>

<CheckBoxPreference
android:key="app_updates"
android:title="@string/check_for_updates"
Expand Down