Merge branch 'conscrypt_disable' into develop
This commit is contained in:
commit
7d814d8ce3
|
@ -7,8 +7,8 @@ android {
|
||||||
applicationId "fr.gouv.etalab.mastodon"
|
applicationId "fr.gouv.etalab.mastodon"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 241
|
versionCode 242
|
||||||
versionName "1.73.0"
|
versionName "1.74.0-beta-1"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
dexOptions {
|
dexOptions {
|
||||||
|
@ -51,7 +51,7 @@ allprojects {
|
||||||
}
|
}
|
||||||
ext.supportLibraryVersion = '28.0.0'
|
ext.supportLibraryVersion = '28.0.0'
|
||||||
ext.glideLibraryVersion = '4.8.0'
|
ext.glideLibraryVersion = '4.8.0'
|
||||||
ext.conscryptLibraryVersion = '1.3.0'
|
ext.conscryptLibraryVersion = '2.0.0'
|
||||||
ext.evernoteLibraryVersion = '1.2.6'
|
ext.evernoteLibraryVersion = '1.2.6'
|
||||||
ext.gsonLibraryVersion = '2.8.2'
|
ext.gsonLibraryVersion = '2.8.2'
|
||||||
ext.guavaLibraryVersion = '24.1-android'
|
ext.guavaLibraryVersion = '24.1-android'
|
||||||
|
|
|
@ -1233,7 +1233,8 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
//Defines the current locale of the device in a static variable
|
//Defines the current locale of the device in a static variable
|
||||||
currentLocale = Helper.currentLocale(getApplicationContext());
|
currentLocale = Helper.currentLocale(getApplicationContext());
|
||||||
|
|
||||||
|
if( tabLayout.getTabAt(0) == null)
|
||||||
|
Helper.logout(BaseMainActivity.thisL);
|
||||||
tabLayout.getTabAt(0).select();
|
tabLayout.getTabAt(0).select();
|
||||||
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA) {
|
||||||
toot.setOnClickListener(new View.OnClickListener() {
|
toot.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
|
@ -44,7 +44,6 @@ import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
@ -736,11 +735,12 @@ public class LoginActivity extends BaseActivity {
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
getMenuInflater().inflate(R.menu.main_login, menu);
|
getMenuInflater().inflate(R.menu.main_login, menu);
|
||||||
CheckBox checkBox= (CheckBox) menu.findItem(R.id.action_custom_tabs).getActionView();
|
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
|
boolean embedded_browser = sharedpreferences.getBoolean(Helper.SET_EMBEDDED_BROWSER, true);
|
||||||
checkBox.setChecked(!embedded_browser);
|
menu.findItem(R.id.action_custom_tabs).setChecked(!embedded_browser);
|
||||||
return true;
|
boolean security_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||||
|
menu.findItem(R.id.action_provider).setChecked(security_provider);
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -767,6 +767,13 @@ public class LoginActivity extends BaseActivity {
|
||||||
editor.putBoolean(Helper.SET_EMBEDDED_BROWSER, !item.isChecked());
|
editor.putBoolean(Helper.SET_EMBEDDED_BROWSER, !item.isChecked());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
return false;
|
return false;
|
||||||
|
}else if(id == R.id.action_provider){
|
||||||
|
item.setChecked(!item.isChecked());
|
||||||
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putBoolean(Helper.SET_SECURITY_PROVIDER, item.isChecked());
|
||||||
|
editor.apply();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,12 @@ import fr.gouv.etalab.mastodon.jobs.NotificationsSyncJob;
|
||||||
public class MainApplication extends MultiDexApplication {
|
public class MainApplication extends MultiDexApplication {
|
||||||
|
|
||||||
|
|
||||||
|
private static MainApplication app;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
app = this;
|
||||||
//System.setProperty("java.net.preferIPv4Stack" , "true");
|
//System.setProperty("java.net.preferIPv4Stack" , "true");
|
||||||
JobManager.create(this).addJobCreator(new ApplicationJob());
|
JobManager.create(this).addJobCreator(new ApplicationJob());
|
||||||
NotificationsSyncJob.schedule(false);
|
NotificationsSyncJob.schedule(false);
|
||||||
|
@ -71,7 +74,7 @@ public class MainApplication extends MultiDexApplication {
|
||||||
SUPPORTED_LOCALES.add(Locale.getDefault());
|
SUPPORTED_LOCALES.add(Locale.getDefault());
|
||||||
}
|
}
|
||||||
LocaleChanger.initialize(getApplicationContext(), SUPPORTED_LOCALES);
|
LocaleChanger.initialize(getApplicationContext(), SUPPORTED_LOCALES);
|
||||||
}catch (Exception ignored){ignored.printStackTrace();}
|
}catch (Exception ignored){}
|
||||||
//Initialize upload service
|
//Initialize upload service
|
||||||
UploadService.NAMESPACE = BuildConfig.APPLICATION_ID;
|
UploadService.NAMESPACE = BuildConfig.APPLICATION_ID;
|
||||||
Toasty.Config.getInstance()
|
Toasty.Config.getInstance()
|
||||||
|
@ -85,10 +88,15 @@ public class MainApplication extends MultiDexApplication {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base)
|
protected void attachBaseContext(Context base)
|
||||||
{
|
{
|
||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
MultiDex.install(MainApplication.this);
|
MultiDex.install(MainApplication.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MainApplication getApp(){
|
||||||
|
return app;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package fr.gouv.etalab.mastodon.client;
|
package fr.gouv.etalab.mastodon.client;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
@ -12,6 +14,9 @@ import javax.net.ssl.SSLEngine;
|
||||||
import javax.net.ssl.SSLSocket;
|
import javax.net.ssl.SSLSocket;
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
|
||||||
|
import fr.gouv.etalab.mastodon.activities.MainApplication;
|
||||||
|
import fr.gouv.etalab.mastodon.helper.Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 29/08/2017.
|
* Created by Thomas on 29/08/2017.
|
||||||
*
|
*
|
||||||
|
@ -78,7 +83,15 @@ public class TLSSocketFactory extends SSLSocketFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Socket enableTLSOnSocket(Socket socket) {
|
private Socket enableTLSOnSocket(Socket socket) {
|
||||||
if(socket != null && (socket instanceof SSLSocket)) {
|
if((socket instanceof SSLSocket)) {
|
||||||
|
boolean security_provider = false;
|
||||||
|
try {
|
||||||
|
SharedPreferences sharedpreferences = MainApplication.getApp().getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
|
security_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||||
|
}catch (Exception ignored){}
|
||||||
|
if( security_provider)
|
||||||
|
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2", "TLSv1.3"});
|
||||||
|
else
|
||||||
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
|
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
|
||||||
}
|
}
|
||||||
return socket;
|
return socket;
|
||||||
|
|
|
@ -223,6 +223,19 @@ public class SettingsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
boolean patch_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||||
|
final CheckBox set_security_provider = rootView.findViewById(R.id.set_security_provider);
|
||||||
|
set_security_provider.setChecked(patch_provider);
|
||||||
|
|
||||||
|
set_security_provider.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
editor.putBoolean(Helper.SET_SECURITY_PROVIDER, set_security_provider.isChecked());
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
boolean display_card = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CARD, false);
|
boolean display_card = sharedpreferences.getBoolean(Helper.SET_DISPLAY_CARD, false);
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,7 @@ import fr.gouv.etalab.mastodon.activities.BaseMainActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.HashTagActivity;
|
import fr.gouv.etalab.mastodon.activities.HashTagActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||||
|
import fr.gouv.etalab.mastodon.activities.MainApplication;
|
||||||
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||||
import fr.gouv.etalab.mastodon.activities.WebviewActivity;
|
import fr.gouv.etalab.mastodon.activities.WebviewActivity;
|
||||||
import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask;
|
import fr.gouv.etalab.mastodon.asynctasks.RemoveAccountAsyncTask;
|
||||||
|
@ -368,6 +369,7 @@ public class Helper {
|
||||||
public static final String SET_TRUNCATE_TOOTS_SIZE = "set_truncate_toots_size";
|
public static final String SET_TRUNCATE_TOOTS_SIZE = "set_truncate_toots_size";
|
||||||
public static final String SET_ART_WITH_NSFW = "set_art_with_nsfw";
|
public static final String SET_ART_WITH_NSFW = "set_art_with_nsfw";
|
||||||
public static final String SET_OPTIMIZE_LOADING = "set_optimize_loading";
|
public static final String SET_OPTIMIZE_LOADING = "set_optimize_loading";
|
||||||
|
public static final String SET_SECURITY_PROVIDER = "set_security_provider";
|
||||||
//End points
|
//End points
|
||||||
public static final String EP_AUTHORIZE = "/oauth/authorize";
|
public static final String EP_AUTHORIZE = "/oauth/authorize";
|
||||||
|
|
||||||
|
@ -2944,6 +2946,14 @@ public class Helper {
|
||||||
|
|
||||||
|
|
||||||
public static void installProvider(){
|
public static void installProvider(){
|
||||||
|
|
||||||
|
boolean patch_provider = true;
|
||||||
|
try {
|
||||||
|
Context ctx = MainApplication.getApp();
|
||||||
|
SharedPreferences sharedpreferences = ctx.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||||
|
patch_provider = sharedpreferences.getBoolean(Helper.SET_SECURITY_PROVIDER, true);
|
||||||
|
}catch (Exception ignored){}
|
||||||
|
if( patch_provider)
|
||||||
try {
|
try {
|
||||||
Security.insertProviderAt(Conscrypt.newProvider(),1);
|
Security.insertProviderAt(Conscrypt.newProvider(),1);
|
||||||
}catch (Exception ignored){}
|
}catch (Exception ignored){}
|
||||||
|
|
|
@ -479,7 +479,13 @@
|
||||||
android:text="@string/set_optimize_loading"
|
android:text="@string/set_optimize_loading"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/set_security_provider"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/settings_checkbox_margin"
|
||||||
|
android:layout_marginBottom="@dimen/settings_checkbox_margin"
|
||||||
|
android:text="@string/set_security_provider"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -484,6 +484,13 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/set_security_provider"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/settings_checkbox_margin"
|
||||||
|
android:layout_marginBottom="@dimen/settings_checkbox_margin"
|
||||||
|
android:text="@string/set_security_provider"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
<!-- TRUNCATE LONG TOOTS -->
|
<!-- TRUNCATE LONG TOOTS -->
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
|
|
@ -17,4 +17,8 @@
|
||||||
android:title="@string/custom_tabs"
|
android:title="@string/custom_tabs"
|
||||||
app:actionViewClass="android.widget.CheckBox"
|
app:actionViewClass="android.widget.CheckBox"
|
||||||
android:checkable="true"/>
|
android:checkable="true"/>
|
||||||
|
<item android:id="@+id/action_provider"
|
||||||
|
android:title="@string/set_security_provider"
|
||||||
|
app:actionViewClass="android.widget.CheckBox"
|
||||||
|
android:checkable="true"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -878,6 +878,7 @@
|
||||||
<string name="set_compact">Compact</string>
|
<string name="set_compact">Compact</string>
|
||||||
<string name="set_console">Console</string>
|
<string name="set_console">Console</string>
|
||||||
<string name="set_mode">Set display mode</string>
|
<string name="set_mode">Set display mode</string>
|
||||||
|
<string name="set_security_provider">Patch the Security Provider</string>
|
||||||
<!-- end languages -->
|
<!-- end languages -->
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue