use of org.wordpress.android.fluxc.persistence.WellSqlConfig in project WordPress-Android by wordpress-mobile.
the class FluxCMigrationTest method setUp.
@Override
protected void setUp() throws Exception {
// Needed for Mockito
System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath());
mRenamingTargetAppContext = new RenamingDelegatingContext(getInstrumentation().getTargetContext().getApplicationContext(), "test_");
mTestContext = getInstrumentation().getContext();
mSiteStore = new SiteStore(new Dispatcher(), Mockito.mock(SiteRestClient.class), Mockito.mock(SiteXMLRPCClient.class));
WellSqlConfig config = new TestWellSqlConfig(mRenamingTargetAppContext);
WellSql.init(config);
config.reset();
super.setUp();
}
use of org.wordpress.android.fluxc.persistence.WellSqlConfig in project WordPress-Android by wordpress-mobile.
the class WordPress method onCreate.
@Override
public void onCreate() {
super.onCreate();
mContext = this;
long startDate = SystemClock.elapsedRealtime();
// Init WellSql
WellSql.init(new WellSqlConfig(getApplicationContext()));
// Init Dagger
mAppComponent = DaggerAppComponent.builder().appContextModule(new AppContextModule(getApplicationContext())).build();
component().inject(this);
mDispatcher.register(this);
// Init static fields from dagger injected singletons, for legacy Actions/Utils
sRequestQueue = mRequestQueue;
sImageLoader = mImageLoader;
sOAuthAuthenticator = mOAuthAuthenticator;
ProfilingUtils.start("App Startup");
// Enable log recording
AppLog.enableRecording(true);
AppLog.i(T.UTILS, "WordPress.onCreate");
if (!PackageUtils.isDebugBuild()) {
Fabric.with(this, new Crashlytics());
}
// If the migration was not done and if we have something to migrate
runFluxCMigration();
versionName = PackageUtils.getVersionName(this);
initWpDb();
enableHttpResponseCache(mContext);
// EventBus setup
EventBus.TAG = "WordPress-EVENT";
EventBus.builder().logNoSubscriberMessages(false).sendNoSubscriberEvent(false).throwSubscriberException(true).installDefaultEventBus();
RestClientUtils.setUserAgent(getUserAgent());
// PasscodeLock setup
if (!AppLockManager.getInstance().isAppLockFeatureEnabled()) {
// Make sure that PasscodeLock isn't already in place.
// Notifications services can enable it before the app is started.
AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
}
if (AppLockManager.getInstance().isAppLockFeatureEnabled()) {
AppLockManager.getInstance().getAppLock().setExemptActivities(new String[] { "org.wordpress.android.ui.ShareIntentReceiverActivity" });
}
HelpshiftHelper.init(this);
ApplicationLifecycleMonitor applicationLifecycleMonitor = new ApplicationLifecycleMonitor();
registerComponentCallbacks(applicationLifecycleMonitor);
registerActivityLifecycleCallbacks(applicationLifecycleMonitor);
initAnalytics(SystemClock.elapsedRealtime() - startDate);
// If users uses a custom locale set it on start of application
WPActivityUtils.applyLocale(getContext());
// Allows vector drawable from resources (in selectors for instance) on Android < 21 (can cause issues
// with memory usage and the use of Configuration). More informations:
// https://developer.android.com/reference/android/support/v7/app/AppCompatDelegate.html#setCompatVectorFromResourcesEnabled(boolean)
// Note: if removed, this will cause crashes on Android < 21
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
Aggregations