Commit 90ca5d6e authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Moves all debug stuff to the debug folder.

parent 24478040
......@@ -84,6 +84,11 @@ android {
//avoiding okio error: https://github.com/square/okhttp/issues/896
lintConfig file("lint.xml")
}
sourceSets {
debug {
manifest.srcFile 'src/debug/AndroidManifest.xml'
}
}
}
play {
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="chat.rocket.android"
xmlns:tools="http://schemas.android.com/tools">
<application
tools:replace="android:name"
android:name=".RocketChatApplicationDebug"/>
</manifest>
\ No newline at end of file
package chat.rocket.android;
import android.os.StrictMode;
import com.facebook.stetho.Stetho;
import com.uphyca.stetho_realm.RealmInspectorModulesProvider;
public class RocketChatApplicationDebug extends RocketChatApplication {
@Override
public void onCreate() {
super.onCreate();
enableStrictMode();
enableStetho();
}
private void enableStrictMode() {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.build());
}
private void enableStetho() {
Stetho.initialize(Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
.build());
}
}
package chat.rocket.android;
import android.os.StrictMode;
import android.support.multidex.MultiDexApplication;
import com.crashlytics.android.Crashlytics;
import com.facebook.stetho.Stetho;
import com.uphyca.stetho_realm.RealmInspectorModulesProvider;
import io.fabric.sdk.android.Fabric;
import java.util.List;
......@@ -19,13 +16,9 @@ import chat.rocket.persistence.realm.RocketChatPersistenceRealm;
* Customized Application-class for Rocket.Chat
*/
public class RocketChatApplication extends MultiDexApplication {
@Override
public void onCreate() {
if (BuildConfig.DEBUG) {
enableStrictMode();
enableStetho();
}
super.onCreate();
Fabric.with(this, new Crashlytics());
......@@ -38,25 +31,4 @@ public class RocketChatApplication extends MultiDexApplication {
RocketChatWidgets.initialize(this, OkHttpHelper.getClientForDownloadFile(this));
}
private void enableStrictMode() {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.build());
}
private void enableStetho() {
Stetho.initialize(Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(RealmInspectorModulesProvider.builder(this).build())
.build());
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment