|
31 | 31 | import android.app.AlertDialog;
|
32 | 32 | import android.app.Application;
|
33 | 33 | import android.app.NotificationManager;
|
34 |
| -import android.app.PendingIntent; |
35 | 34 | import android.content.ContentValues;
|
36 | 35 | import android.content.Context;
|
37 | 36 | import android.content.Intent;
|
@@ -433,6 +432,7 @@ static OSInAppMessageController getInAppMessageController() {
|
433 | 432 | private static OSSessionManager sessionManager = new OSSessionManager(sessionListener, trackerFactory, logger);
|
434 | 433 | @Nullable private static OSOutcomeEventsController outcomeEventsController;
|
435 | 434 | @Nullable private static OSOutcomeEventsFactory outcomeEventsFactory;
|
| 435 | + @Nullable private static OSNotificationDataController notificationCache; |
436 | 436 |
|
437 | 437 | @Nullable private static AdvertisingIdentifierProvider adIdProvider;
|
438 | 438 | private static synchronized @Nullable AdvertisingIdentifierProvider getAdIdProvider() {
|
@@ -835,17 +835,21 @@ private static void setupContextListeners(boolean wasAppContextNull) {
|
835 | 835 |
|
836 | 836 | // Do work here that should only happen once or at the start of a new lifecycle
|
837 | 837 | if (wasAppContextNull) {
|
| 838 | + // Prefs require a context to save |
| 839 | + // If the previous state of appContext was null, kick off write in-case it was waiting |
| 840 | + OneSignalPrefs.startDelayedWrite(); |
| 841 | + notificationCache = new OSNotificationDataController(getDBHelperInstance()); |
| 842 | + // Cleans out old cached data to prevent over using the storage on devices |
| 843 | + notificationCache.cleanOldCachedData(); |
| 844 | + |
| 845 | + getInAppMessageController().cleanCachedInAppMessages(); |
| 846 | + |
838 | 847 | if (outcomeEventsFactory == null)
|
839 | 848 | outcomeEventsFactory = new OSOutcomeEventsFactory(logger, apiClient, getDBHelperInstance(), preferences);
|
840 | 849 |
|
841 | 850 | sessionManager.initSessionFromCache();
|
842 | 851 | outcomeEventsController = new OSOutcomeEventsController(sessionManager, outcomeEventsFactory);
|
843 | 852 | outcomeEventsController.cleanCachedUniqueOutcomes();
|
844 |
| - // Prefs require a context to save |
845 |
| - // If the previous state of appContext was null, kick off write in-case it was waiting |
846 |
| - OneSignalPrefs.startDelayedWrite(); |
847 |
| - // Cleans out old cached data to prevent over using the storage on devices |
848 |
| - OneSignalCacheCleaner.cleanOldCachedData(appContext); |
849 | 853 | }
|
850 | 854 | }
|
851 | 855 |
|
|
0 commit comments