Search in sources :

Example 1 with LanguageContext

use of com.onesignal.language.LanguageContext in project OneSignal-Android-SDK by OneSignal.

the class OneSignal method setupContextListeners.

private static void setupContextListeners(boolean wasAppContextNull) {
    // Register the lifecycle listener of the app for state changes in activities with proper context
    ActivityLifecycleListener.registerActivityLifecycleCallbacks((Application) appContext);
    // Do work here that should only happen once or at the start of a new lifecycle
    if (wasAppContextNull) {
        // Set Language Context to null
        languageContext = new LanguageContext(preferences);
        // Prefs require a context to save
        // If the previous state of appContext was null, kick off write in-case it was waiting
        OneSignalPrefs.startDelayedWrite();
        OneSignalDbHelper dbHelper = getDBHelperInstance();
        notificationDataController = new OSNotificationDataController(dbHelper, logger);
        // Cleans out old cached data to prevent over using the storage on devices
        notificationDataController.cleanOldCachedData();
        getInAppMessageController().cleanCachedInAppMessages();
        if (outcomeEventsFactory == null)
            outcomeEventsFactory = new OSOutcomeEventsFactory(logger, apiClient, dbHelper, preferences);
        sessionManager.initSessionFromCache();
        outcomeEventsController = new OSOutcomeEventsController(sessionManager, outcomeEventsFactory);
        outcomeEventsController.cleanCachedUniqueOutcomes();
    }
}
Also used : LanguageContext(com.onesignal.language.LanguageContext) OSOutcomeEventsFactory(com.onesignal.outcomes.data.OSOutcomeEventsFactory)

Aggregations

LanguageContext (com.onesignal.language.LanguageContext)1 OSOutcomeEventsFactory (com.onesignal.outcomes.data.OSOutcomeEventsFactory)1