Removes Safetynet library
This commit is contained in:
parent
d326877c91
commit
a997fcd73c
|
@ -21,7 +21,7 @@ android {
|
|||
productFlavors {
|
||||
fdroid {
|
||||
}
|
||||
safetynet {
|
||||
playstore {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,5 @@ dependencies {
|
|||
implementation 'org.jsoup:jsoup:1.10.3'
|
||||
implementation 'com.github.stom79:country-picker-android:1.2.0'
|
||||
implementation 'com.github.stom79:mytransl:1.2'
|
||||
safetynetImplementation 'com.google.android.gms:play-services-safetynet:11.6.2'
|
||||
safetynetImplementation 'io.github.kobakei:ratethisapp:1.2.0'
|
||||
playstoreImplementation 'io.github.kobakei:ratethisapp:1.2.0'
|
||||
}
|
||||
|
|
|
@ -16,10 +16,6 @@ package fr.gouv.etalab.mastodon.activities;
|
|||
|
||||
public class MainActivity extends BaseMainActivity {
|
||||
|
||||
@Override
|
||||
protected void installProviders() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rateThisApp() {
|
||||
|
|
|
@ -151,7 +151,6 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
|
||||
installProviders();
|
||||
|
||||
final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
if( theme == Helper.THEME_LIGHT){
|
||||
|
@ -853,7 +852,6 @@ public abstract class BaseMainActivity extends AppCompatActivity
|
|||
new RetrieveInstanceAsyncTask(getApplicationContext(), BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
protected abstract void installProviders();
|
||||
|
||||
protected abstract void rateThisApp();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
|
|||
* Login activity class which handles the connection
|
||||
*/
|
||||
|
||||
public abstract class BaseLoginActivity extends AppCompatActivity {
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private String client_id;
|
||||
private String client_secret;
|
||||
|
@ -71,7 +71,6 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
installProviders();
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
if( theme == Helper.THEME_LIGHT){
|
||||
|
@ -133,9 +132,9 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
}
|
||||
login_instance.setAdapter(null);
|
||||
ArrayAdapter<String> adapter =
|
||||
new ArrayAdapter<>(BaseLoginActivity.this, android.R.layout.simple_list_item_1, instances);
|
||||
new ArrayAdapter<>(LoginActivity.this, android.R.layout.simple_list_item_1, instances);
|
||||
login_instance.setAdapter(adapter);
|
||||
if( login_instance.hasFocus() && !BaseLoginActivity.this.isFinishing())
|
||||
if( login_instance.hasFocus() && !LoginActivity.this.isFinishing())
|
||||
login_instance.showDropDown();
|
||||
|
||||
} catch (JSONException ignored) {isLoadingInstance = false;}
|
||||
|
@ -178,7 +177,6 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
});
|
||||
}
|
||||
|
||||
protected abstract void installProviders();
|
||||
|
||||
@Override
|
||||
protected void onResume(){
|
||||
|
@ -196,7 +194,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
try {
|
||||
instance = URLEncoder.encode(login_instance.getText().toString().trim(), "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Toast.makeText(BaseLoginActivity.this,R.string.client_error, Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(LoginActivity.this,R.string.client_error, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
final String action = "/api/v1/apps";
|
||||
final HashMap<String, String> parameters = new HashMap<>();
|
||||
|
@ -227,7 +225,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
connectionButton.setEnabled(true);
|
||||
login_two_step.setVisibility(View.VISIBLE);
|
||||
if( client_id_for_webview){
|
||||
Intent i = new Intent(BaseLoginActivity.this, WebviewConnectActivity.class);
|
||||
Intent i = new Intent(LoginActivity.this, WebviewConnectActivity.class);
|
||||
i.putExtra("instance", instance);
|
||||
startActivity(i);
|
||||
}
|
||||
|
@ -278,7 +276,7 @@ public abstract class BaseLoginActivity extends AppCompatActivity {
|
|||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token);
|
||||
editor.apply();
|
||||
//Update the account with the token;
|
||||
new UpdateAccountInfoAsyncTask(BaseLoginActivity.this, token, instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
new UpdateAccountInfoAsyncTask(LoginActivity.this, token, instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
} catch (JSONException ignored) {}
|
||||
}
|
||||
});
|
|
@ -14,14 +14,16 @@
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.activities;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 23/04/2017.
|
||||
* Login activity class which handles the connection
|
||||
*/
|
||||
|
||||
public class LoginActivity extends BaseLoginActivity {
|
||||
import com.kobakei.ratethisapp.RateThisApp;
|
||||
|
||||
|
||||
public class MainActivity extends BaseMainActivity {
|
||||
|
||||
@Override
|
||||
protected void installProviders() {
|
||||
// do nothing
|
||||
protected void rateThisApp() {
|
||||
RateThisApp.onCreate(this);
|
||||
RateThisApp.showRateDialogIfNeeded(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/* Copyright 2017 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Mastalab
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Mastalab 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 Mastalab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.activities;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
import com.google.android.gms.security.ProviderInstaller;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 23/04/2017.
|
||||
* Login activity class which handles the connection
|
||||
*/
|
||||
|
||||
public class LoginActivity extends BaseLoginActivity implements ProviderInstaller.ProviderInstallListener {
|
||||
|
||||
private static final int ERROR_DIALOG_REQUEST_CODE = 97;
|
||||
|
||||
@Override
|
||||
protected void installProviders() {
|
||||
ProviderInstaller.installIfNeededAsync(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderInstalled() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == ERROR_DIALOG_REQUEST_CODE) {
|
||||
// Adding a fragment via GooglePlayServicesUtil.showErrorDialogFragment
|
||||
// before the instance state is restored throws an error. So instead,
|
||||
// set a flag here, which will cause the fragment to delay until
|
||||
// onPostResume.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) {
|
||||
if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) {
|
||||
// Recoverable error. Show a dialog prompting the user to
|
||||
// install/update/enable Google Play services.
|
||||
GooglePlayServicesUtil.showErrorDialogFragment(
|
||||
errorCode,
|
||||
this,
|
||||
ERROR_DIALOG_REQUEST_CODE,
|
||||
new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
// The user chose not to take the recovery action
|
||||
onProviderInstallerNotAvailable();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Google Play services is not available.
|
||||
onProviderInstallerNotAvailable();
|
||||
}
|
||||
}
|
||||
|
||||
private void onProviderInstallerNotAvailable() {
|
||||
// This is reached if the provider cannot be updated for some reason.
|
||||
// App should consider all HTTP communication to be vulnerable, and take
|
||||
// appropriate action.
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/* Copyright 2017 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Mastalab
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Mastalab 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 Mastalab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
package fr.gouv.etalab.mastodon.activities;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
import com.google.android.gms.security.ProviderInstaller;
|
||||
import com.kobakei.ratethisapp.RateThisApp;
|
||||
|
||||
|
||||
public class MainActivity extends BaseMainActivity
|
||||
implements ProviderInstaller.ProviderInstallListener {
|
||||
private static final int ERROR_DIALOG_REQUEST_CODE = 97;
|
||||
|
||||
@Override
|
||||
protected void rateThisApp() {
|
||||
RateThisApp.onCreate(this);
|
||||
RateThisApp.showRateDialogIfNeeded(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installProviders() {
|
||||
ProviderInstaller.installIfNeededAsync(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderInstalled() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == ERROR_DIALOG_REQUEST_CODE) {
|
||||
// Adding a fragment via GooglePlayServicesUtil.showErrorDialogFragment
|
||||
// before the instance state is restored throws an error. So instead,
|
||||
// set a flag here, which will cause the fragment to delay until
|
||||
// onPostResume.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) {
|
||||
if (GooglePlayServicesUtil.isUserRecoverableError(errorCode)) {
|
||||
// Recoverable error. Show a dialog prompting the user to
|
||||
// install/update/enable Google Play services.
|
||||
GooglePlayServicesUtil.showErrorDialogFragment(
|
||||
errorCode,
|
||||
this,
|
||||
ERROR_DIALOG_REQUEST_CODE,
|
||||
new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
// The user chose not to take the recovery action
|
||||
onProviderInstallerNotAvailable();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Google Play services is not available.
|
||||
onProviderInstallerNotAvailable();
|
||||
}
|
||||
}
|
||||
|
||||
private void onProviderInstallerNotAvailable() {
|
||||
// This is reached if the provider cannot be updated for some reason.
|
||||
// App should consider all HTTP communication to be vulnerable, and take
|
||||
// appropriate action.
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue