Browse Source

Fix for I2PAndroidHelper.isI2PAndroidRunning() always returning false

Requires v0.7 of the I2P client library, which will be released once I2P 0.9.20
is released.
master
str4d 10 years ago
parent
commit
6e8da9f6d3
  1. 2
      app/build.gradle
  2. 7
      app/proguard-project.txt
  3. 16
      app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

2
app/build.gradle

@ -39,5 +39,5 @@ dependencies { @@ -39,5 +39,5 @@ dependencies {
compile 'com.android.support:palette-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'org.jsoup:jsoup:1.8.1'
compile 'net.i2p.android:client:0.6@aar'
compile 'net.i2p.android:client:0.7@aar'
}

7
app/proguard-project.txt

@ -78,7 +78,8 @@ @@ -78,7 +78,8 @@
# platform version. We know about them, and they are safe.
-dontwarn android.support.**
# The I2P Java API bundled inside the I2P Android client library contains a
# method that references classes in javax.naming that Android doesn't have. But
# the method never uses those classes on Android, and is safe.
# The I2P Java API bundled inside the I2P Android client library contains
# references to javax.naming classes that Android doesn't have. But those
# classes are never used on Android, and it is safe to ignore the warnings.
-dontwarn net.i2p.crypto.CertUtil
-dontwarn org.apache.http.conn.ssl.DefaultHostnameVerifier

16
app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

@ -184,6 +184,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -184,6 +184,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
// Helper
private I2PAndroidHelper mI2PHelper;
private boolean mI2PHelperBound;
private boolean mI2PProxyInitialized;
// Constant
private static final int API = android.os.Build.VERSION.SDK_INT;
@ -626,7 +628,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -626,7 +628,8 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
break;
case 2:
if (!mI2PHelper.isI2PAndroidRunning()) {
mI2PProxyInitialized = true;
if (mI2PHelperBound && !mI2PHelper.isI2PAndroidRunning()) {
mI2PHelper.requestI2PAndroidStart(this);
}
host = "localhost";
@ -807,6 +810,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -807,6 +810,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
} catch (Exception e) {
e.printStackTrace();
}
mI2PProxyInitialized = false;
}
}
@ -1468,6 +1472,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -1468,6 +1472,7 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
protected void onStop() {
super.onStop();
mI2PHelper.unbind();
mI2PHelperBound = false;
}
@Override
@ -1484,7 +1489,14 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll @@ -1484,7 +1489,14 @@ public class BrowserActivity extends ThemableActivity implements BrowserControll
super.onStart();
if (mPreferences.getProxyChoice() == 2) {
// Try to bind to I2P Android
mI2PHelper.bind();
mI2PHelper.bind(new I2PAndroidHelper.Callback() {
@Override
public void onI2PAndroidBound() {
mI2PHelperBound = true;
if (mI2PProxyInitialized && !mI2PHelper.isI2PAndroidRunning())
mI2PHelper.requestI2PAndroidStart(BrowserActivity.this);
}
});
}
}

Loading…
Cancel
Save