parent
7516137d94
commit
337cf8acdb
|
@ -7,7 +7,7 @@ buildscript {
|
|||
maven { url 'https://plugins.gradle.org/m2/' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
|
||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
|
||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath('fr.avianey.androidsvgdrawable:gradle-plugin:3.0.0') {
|
||||
|
|
|
@ -45,7 +45,7 @@ dependencies {
|
|||
compile 'org.apache.commons:commons-lang3:3.4'
|
||||
compile 'com.github.mariotaku.RestFu:library:0.9.17'
|
||||
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.2'
|
||||
compile 'com.github.mariotaku.SQLiteQB:library:0.9.4'
|
||||
compile 'com.github.mariotaku:SQLiteQB:0.9.4'
|
||||
compile 'com.github.mariotaku.ObjectCursor:core:0.9.3'
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
|
|
@ -151,8 +151,6 @@ public interface SharedPreferenceConstants {
|
|||
String KEY_LEFTSIDE_COMPOSE_BUTTON = "leftside_compose_button";
|
||||
@Preference(type = BOOLEAN, exportable = false, hasDefault = true, defaultBoolean = false)
|
||||
String KEY_ATTACH_LOCATION = "attach_location";
|
||||
@Preference(type = BOOLEAN)
|
||||
String KEY_IGNORE_SSL_ERROR = "ignore_ssl_error";
|
||||
@Preference(type = STRING)
|
||||
String KEY_QUOTE_FORMAT = "quote_format";
|
||||
@Preference(type = BOOLEAN)
|
||||
|
|
|
@ -23,7 +23,7 @@ android {
|
|||
applicationId "org.mariotaku.twidere"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
versionCode 135
|
||||
versionCode 136
|
||||
versionName "0.3.0"
|
||||
multiDexEnabled true
|
||||
|
||||
|
@ -42,14 +42,15 @@ android {
|
|||
buildTypes {
|
||||
debug {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd")
|
||||
versionNameSuffix String.format(" (dev %s)", format.format(new Date()))
|
||||
versionNameSuffix String.format(" (debug %s)", format.format(new Date()))
|
||||
resValue("bool", "debug", "true")
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
shrinkResources false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd")
|
||||
versionNameSuffix String.format(" (dev %s)", format.format(new Date()))
|
||||
versionNameSuffix String.format(" (%s)", format.format(new Date()))
|
||||
resValue("bool", "debug", "false")
|
||||
}
|
||||
}
|
||||
|
@ -89,14 +90,14 @@ dependencies {
|
|||
compile 'com.commonsware.cwac:layouts:0.4.2'
|
||||
compile 'com.rengwuxian.materialedittext:library:2.1.4'
|
||||
compile 'com.pnikosis:materialish-progress:1.7'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.0.1'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.1.0'
|
||||
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.7'
|
||||
compile 'com.github.johnpersano:supertoasts:1.3.4.1@aar'
|
||||
compile 'com.github.mariotaku:MessageBubbleView:1.2'
|
||||
compile 'com.github.mariotaku:DragSortListView:0.6.1'
|
||||
compile 'com.github.uucky:ColorPicker-Android:0.9.7@aar'
|
||||
compile 'com.github.boxme:asyncmanager:1.0.0'
|
||||
compile 'com.sprylab.android.texturevideoview:texturevideoview:1.0.2'
|
||||
compile 'com.sprylab.android.texturevideoview:texturevideoview:1.1.1'
|
||||
compile 'com.squareup:pollexor:2.0.4'
|
||||
compile 'com.squareup:tape:1.2.3'
|
||||
compile 'org.apache.commons:commons-lang3:3.4'
|
||||
|
@ -107,10 +108,11 @@ dependencies {
|
|||
compile 'com.makeramen:roundedimageview:2.1.1'
|
||||
compile 'com.soundcloud.android:android-crop:1.0.1@aar'
|
||||
compile 'com.hannesdorfmann.parcelableplease:annotation:1.0.2'
|
||||
compile 'com.github.mariotaku:PickNCrop:0.9.2'
|
||||
compile 'com.github.mariotaku:PickNCrop:0.9.3'
|
||||
compile 'com.github.mariotaku.RestFu:library:0.9.17'
|
||||
compile 'com.github.mariotaku.RestFu:okhttp3:0.9.17'
|
||||
compile 'com.github.mariotaku:InetAddressJni:0.9.1'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.1.0'
|
||||
compile 'com.lnikkila:extendedtouchview:0.1.0'
|
||||
compile 'com.google.dagger:dagger:2.0.2'
|
||||
compile 'org.attoparser:attoparser:1.4.0.RELEASE'
|
||||
|
@ -121,7 +123,7 @@ dependencies {
|
|||
// googleCompile 'com.google.maps.android:android-maps-utils:0.4'
|
||||
googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
|
||||
googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar'
|
||||
fdroidCompile 'org.osmdroid:osmdroid-android:5.0.1'
|
||||
fdroidCompile 'org.osmdroid:osmdroid-android:5.1'
|
||||
debugCompile 'com.facebook.stetho:stetho:1.3.0'
|
||||
debugCompile 'com.facebook.stetho:stetho-okhttp3:1.3.0'
|
||||
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
|
||||
|
|
|
@ -15,10 +15,14 @@
|
|||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
-dontobfuscate
|
||||
|
||||
-dontwarn sun.net.spi.**
|
||||
-dontwarn java.nio.file.**
|
||||
-dontwarn org.codehaus.mojo.**
|
||||
-dontwarn com.makeramen.roundedimageview.**
|
||||
|
||||
-keepattributes *Annotation*
|
||||
|
||||
# https://github.com/bluelinelabs/LoganSquare
|
||||
-keep class com.bluelinelabs.logansquare.** { *; }
|
||||
|
@ -26,7 +30,6 @@
|
|||
-keep class **$$JsonObjectMapper { *; }
|
||||
|
||||
# http://square.github.io/otto/
|
||||
-keepattributes *Annotation*
|
||||
-keepclassmembers class ** {
|
||||
@com.squareup.otto.Subscribe public *;
|
||||
@com.squareup.otto.Produce public *;
|
||||
|
@ -38,4 +41,8 @@
|
|||
}
|
||||
-keepclassmembers class android.support.v7.internal.widget.ActionBarOverlayLayout {
|
||||
private android.graphics.drawable.Drawable mWindowContentOverlay;
|
||||
}
|
||||
|
||||
-keepclassmembers class org.mariotaku.twidere.activity.support.BrowserSignInActivity.InjectorJavaScriptInterface {
|
||||
public *;
|
||||
}
|
|
@ -20,24 +20,21 @@
|
|||
package org.mariotaku.twidere.activity.support;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.attoparser.AttoParseException;
|
||||
|
@ -52,6 +49,7 @@ import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
|
|||
import org.mariotaku.twidere.util.AsyncTaskUtils;
|
||||
import org.mariotaku.twidere.util.OAuthPasswordAuthenticator;
|
||||
import org.mariotaku.twidere.util.TwitterAPIFactory;
|
||||
import org.mariotaku.twidere.util.webkit.DefaultWebViewClient;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
@ -148,29 +146,23 @@ public class BrowserSignInActivity extends BaseSupportDialogActivity {
|
|||
mRequestToken = token;
|
||||
}
|
||||
|
||||
static class AuthorizationWebViewClient extends WebViewClient {
|
||||
private final BrowserSignInActivity mActivity;
|
||||
static class AuthorizationWebViewClient extends DefaultWebViewClient {
|
||||
|
||||
AuthorizationWebViewClient(final BrowserSignInActivity activity) {
|
||||
mActivity = activity;
|
||||
super(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(final WebView view, final String url) {
|
||||
super.onPageFinished(view, url);
|
||||
view.loadUrl(INJECT_CONTENT);
|
||||
mActivity.setLoadProgressShown(false);
|
||||
((BrowserSignInActivity) getActivity()).setLoadProgressShown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(final WebView view, final String url, final Bitmap favicon) {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
mActivity.setLoadProgressShown(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadResource(WebView view, String url) {
|
||||
super.onLoadResource(view, url);
|
||||
((BrowserSignInActivity) getActivity()).setLoadProgressShown(true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -178,17 +170,9 @@ public class BrowserSignInActivity extends BaseSupportDialogActivity {
|
|||
public void onReceivedError(final WebView view, final int errorCode, final String description,
|
||||
final String failingUrl) {
|
||||
super.onReceivedError(view, errorCode, description, failingUrl);
|
||||
Toast.makeText(mActivity, R.string.error_occurred, Toast.LENGTH_SHORT).show();
|
||||
mActivity.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(final WebView view, @NonNull final SslErrorHandler handler, final SslError error) {
|
||||
if (mActivity.mPreferences.getBoolean(KEY_IGNORE_SSL_ERROR, false)) {
|
||||
handler.proceed();
|
||||
} else {
|
||||
handler.cancel();
|
||||
}
|
||||
final Activity activity = getActivity();
|
||||
Toast.makeText(activity, R.string.error_occurred, Toast.LENGTH_SHORT).show();
|
||||
activity.finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -196,14 +180,15 @@ public class BrowserSignInActivity extends BaseSupportDialogActivity {
|
|||
final Uri uri = Uri.parse(url);
|
||||
if (url.startsWith(OAUTH_CALLBACK_URL)) {
|
||||
final String oauth_verifier = uri.getQueryParameter(EXTRA_OAUTH_VERIFIER);
|
||||
final OAuthToken requestToken = mActivity.mRequestToken;
|
||||
final BrowserSignInActivity activity = (BrowserSignInActivity) getActivity();
|
||||
final OAuthToken requestToken = activity.mRequestToken;
|
||||
if (oauth_verifier != null && requestToken != null) {
|
||||
final Intent intent = new Intent();
|
||||
intent.putExtra(EXTRA_OAUTH_VERIFIER, oauth_verifier);
|
||||
intent.putExtra(EXTRA_REQUEST_TOKEN, requestToken.getOauthToken());
|
||||
intent.putExtra(EXTRA_REQUEST_TOKEN_SECRET, requestToken.getOauthTokenSecret());
|
||||
mActivity.setResult(RESULT_OK, intent);
|
||||
mActivity.finish();
|
||||
activity.setResult(RESULT_OK, intent);
|
||||
activity.finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.mariotaku.twidere.util;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.SSLCertificateSocketFactory;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
@ -18,9 +17,6 @@ import java.net.InetSocketAddress;
|
|||
import java.net.Proxy;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
import okhttp3.Authenticator;
|
||||
import okhttp3.Credentials;
|
||||
import okhttp3.Dns;
|
||||
|
@ -55,23 +51,10 @@ public class HttpClientFactory implements Constants {
|
|||
public static void updateHttpClientConfiguration(final Context context,
|
||||
final SharedPreferences prefs,
|
||||
Dns dns, final OkHttpClient.Builder builder) {
|
||||
final int connectionTimeoutSeconds = prefs.getInt(KEY_CONNECTION_TIMEOUT, 10);
|
||||
final boolean ignoreSslError = prefs.getBoolean(KEY_IGNORE_SSL_ERROR, false);
|
||||
final long connectionTimeoutMillis = TimeUnit.SECONDS.toMillis(prefs.getInt(KEY_CONNECTION_TIMEOUT, 10));
|
||||
final boolean enableProxy = prefs.getBoolean(KEY_ENABLE_PROXY, false);
|
||||
|
||||
builder.connectTimeout(connectionTimeoutSeconds, TimeUnit.SECONDS);
|
||||
|
||||
if (ignoreSslError) {
|
||||
// We use insecure connections intentionally
|
||||
final int sslConnectTimeout = ((int) TimeUnit.SECONDS.toMillis(connectionTimeoutSeconds));
|
||||
builder.sslSocketFactory(SSLCertificateSocketFactory.getInsecure(sslConnectTimeout, null));
|
||||
builder.hostnameVerifier(new HostnameVerifier() {
|
||||
@Override
|
||||
public boolean verify(String hostname, SSLSession session) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
builder.connectTimeout(connectionTimeoutMillis, TimeUnit.MILLISECONDS);
|
||||
if (enableProxy) {
|
||||
final String proxyType = prefs.getString(KEY_PROXY_TYPE, null);
|
||||
final String proxyHost = prefs.getString(KEY_PROXY_HOST, null);
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.util.net;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
public final class HostResolvedHostnameVerifier implements HostnameVerifier {
|
||||
public HostResolvedHostnameVerifier(Context context, boolean ignoreSSLError) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verify(String hostname, SSLSession session) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.util.net;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/3/31.
|
||||
*/
|
||||
public class TwidereTrustManager implements X509TrustManager {
|
||||
public TwidereTrustManager(Context context) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return new X509Certificate[0];
|
||||
}
|
||||
}
|
|
@ -21,49 +21,19 @@ package org.mariotaku.twidere.util.webkit;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import org.mariotaku.twidere.fragment.BaseWebViewFragment;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
|
||||
|
||||
public class DefaultWebViewClient extends WebViewClient {
|
||||
|
||||
private final Activity mActivity;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
||||
public DefaultWebViewClient(final Activity activity) {
|
||||
mActivity = activity;
|
||||
mPreferences = activity.getSharedPreferences(BaseWebViewFragment.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(final WebView view, final String url) {
|
||||
super.onPageFinished(view, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(final WebView view, final String url, final Bitmap favicon) {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(final WebView view, @NonNull final SslErrorHandler handler,
|
||||
final SslError error) {
|
||||
if (mPreferences.getBoolean(BaseWebViewFragment.KEY_IGNORE_SSL_ERROR, false)) {
|
||||
handler.proceed();
|
||||
} else {
|
||||
handler.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,4 +45,8 @@ public class DefaultWebViewClient extends WebViewClient {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Activity getActivity() {
|
||||
return mActivity;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue