mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
Add Chucker
This commit is contained in:
parent
2870931481
commit
5edd4d5922
@ -152,6 +152,9 @@ dependencies {
|
|||||||
implementation project(":nachos")
|
implementation project(":nachos")
|
||||||
//implementation project(":Navigation")
|
//implementation project(":Navigation")
|
||||||
implementation project(":szkolny-font")
|
implementation project(":szkolny-font")
|
||||||
|
|
||||||
|
debugImplementation "com.github.ChuckerTeam.Chucker:library:3.0.1"
|
||||||
|
releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:3.0.1"
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -21,6 +21,9 @@ import android.util.Log;
|
|||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.chuckerteam.chucker.api.ChuckerCollector;
|
||||||
|
import com.chuckerteam.chucker.api.ChuckerInterceptor;
|
||||||
|
import com.chuckerteam.chucker.api.RetentionManager;
|
||||||
import com.evernote.android.job.JobManager;
|
import com.evernote.android.job.JobManager;
|
||||||
import com.google.android.gms.security.ProviderInstaller;
|
import com.google.android.gms.security.ProviderInstaller;
|
||||||
import com.google.firebase.FirebaseApp;
|
import com.google.firebase.FirebaseApp;
|
||||||
@ -209,6 +212,33 @@ public class App extends androidx.multidex.MultiDexApplication {
|
|||||||
|
|
||||||
cookieJar = new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(this));
|
cookieJar = new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(this));
|
||||||
|
|
||||||
|
appSharedPrefs = getSharedPreferences(getString(R.string.preference_file_global), Context.MODE_PRIVATE);
|
||||||
|
|
||||||
|
loadConfig();
|
||||||
|
|
||||||
|
Themes.INSTANCE.setThemeInt(appConfig.appTheme);
|
||||||
|
|
||||||
|
try {
|
||||||
|
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
|
||||||
|
for (Signature signature: packageInfo.signatures) {
|
||||||
|
byte[] signatureBytes = signature.toByteArray();
|
||||||
|
MessageDigest md = MessageDigest.getInstance("SHA");
|
||||||
|
md.update(signatureBytes);
|
||||||
|
this.signature = Base64.encodeToString(md.digest(), Base64.DEFAULT);
|
||||||
|
//Log.d(TAG, "Signature is "+this.signature);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("f054761fbdb6a238".equals(deviceId)) {
|
||||||
|
devMode = true;
|
||||||
|
}
|
||||||
|
else if (appConfig.devModePassword != null) {
|
||||||
|
checkDevModePassword();
|
||||||
|
}
|
||||||
|
|
||||||
OkHttpClient.Builder httpBuilder = new OkHttpClient.Builder()
|
OkHttpClient.Builder httpBuilder = new OkHttpClient.Builder()
|
||||||
.cache(null)
|
.cache(null)
|
||||||
.followRedirects(true)
|
.followRedirects(true)
|
||||||
@ -256,6 +286,12 @@ public class App extends androidx.multidex.MultiDexApplication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (App.devMode || BuildConfig.DEBUG) {
|
||||||
|
ChuckerCollector chuckerCollector = new ChuckerCollector(this, true, RetentionManager.Period.ONE_HOUR);
|
||||||
|
ChuckerInterceptor chuckerInterceptor = new ChuckerInterceptor(this, chuckerCollector);
|
||||||
|
httpBuilder.addInterceptor(chuckerInterceptor);
|
||||||
|
}
|
||||||
|
|
||||||
http = httpBuilder.build();
|
http = httpBuilder.build();
|
||||||
httpLazy = http.newBuilder().followRedirects(false).followSslRedirects(false).build();
|
httpLazy = http.newBuilder().followRedirects(false).followSslRedirects(false).build();
|
||||||
|
|
||||||
@ -264,35 +300,8 @@ public class App extends androidx.multidex.MultiDexApplication {
|
|||||||
|
|
||||||
//register = new Register(mContext);
|
//register = new Register(mContext);
|
||||||
|
|
||||||
appSharedPrefs = getSharedPreferences(getString(R.string.preference_file_global), Context.MODE_PRIVATE);
|
|
||||||
|
|
||||||
loadConfig();
|
|
||||||
|
|
||||||
Themes.INSTANCE.setThemeInt(appConfig.appTheme);
|
|
||||||
|
|
||||||
//profileLoadById(appSharedPrefs.getInt("current_profile_id", 1));
|
//profileLoadById(appSharedPrefs.getInt("current_profile_id", 1));
|
||||||
|
|
||||||
try {
|
|
||||||
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
|
|
||||||
for (Signature signature: packageInfo.signatures) {
|
|
||||||
byte[] signatureBytes = signature.toByteArray();
|
|
||||||
MessageDigest md = MessageDigest.getInstance("SHA");
|
|
||||||
md.update(signatureBytes);
|
|
||||||
this.signature = Base64.encodeToString(md.digest(), Base64.DEFAULT);
|
|
||||||
//Log.d(TAG, "Signature is "+this.signature);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("f054761fbdb6a238".equals(deviceId)) {
|
|
||||||
devMode = true;
|
|
||||||
}
|
|
||||||
else if (appConfig.devModePassword != null) {
|
|
||||||
checkDevModePassword();
|
|
||||||
}
|
|
||||||
|
|
||||||
JobManager.create(this).addJobCreator(new JobsCreator());
|
JobManager.create(this).addJobCreator(new JobsCreator());
|
||||||
if (appConfig.registerSyncEnabled) {
|
if (appConfig.registerSyncEnabled) {
|
||||||
SyncJob.schedule(this);
|
SyncJob.schedule(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user