File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
OneSignalSDK/onesignal/src/main/java/com/onesignal Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 26
26
class OSInAppMessageController implements OSDynamicTriggerControllerObserver , OSSystemConditionController .OSSystemConditionObserver {
27
27
28
28
private static final Object LOCK = new Object ();
29
+ private final static String OS_DELETE_CACHED_REDISPLAYED_IAMS_THREAD = "OS_DELETE_CACHED_REDISPLAYED_IAMS_THREAD" ;
29
30
private static final String OS_SAVE_IN_APP_MESSAGE = "OS_SAVE_IN_APP_MESSAGE" ;
30
31
public static final String IN_APP_MESSAGES_JSON_KEY = "in_app_messages" ;
31
32
private static ArrayList <String > PREFERRED_VARIANT_ORDER = new ArrayList <String >() {{
@@ -826,6 +827,23 @@ void onSuccess(String response) {
826
827
}, null );
827
828
}
828
829
830
+ /**
831
+ * Remove IAMs that the last display time was six month ago
832
+ * 1. Query for all old message ids and old clicked click ids
833
+ * 2. Delete old IAMs from SQL
834
+ * 3. Use queried data to clean SharedPreferences
835
+ */
836
+ void cleanCachedInAppMessages () {
837
+ new Thread (new Runnable () {
838
+ @ Override
839
+ public void run () {
840
+ Thread .currentThread ().setPriority (Process .THREAD_PRIORITY_BACKGROUND );
841
+
842
+ inAppMessageRepository .cleanCachedInAppMessages ();
843
+ }
844
+ }, OS_DELETE_CACHED_REDISPLAYED_IAMS_THREAD ).start ();
845
+ }
846
+
829
847
/**
830
848
* Part of redisplay logic
831
849
* <p>
Original file line number Diff line number Diff line change @@ -147,7 +147,6 @@ synchronized void cleanCachedInAppMessages() {
147
147
* Note: This should only ever be called by {@link OSInAppMessageRepository#cleanCachedInAppMessages()}
148
148
* <br/><br/>
149
149
*
150
- * @see OneSignalCacheCleaner#cleanCachedInAppMessages(OneSignalDbHelper)
151
150
* @see OSInAppMessageRepository#cleanCachedInAppMessages()
152
151
*/
153
152
private void cleanInAppMessageIds (Set <String > oldMessageIds ) {
@@ -187,7 +186,6 @@ private void cleanInAppMessageIds(Set<String> oldMessageIds) {
187
186
* Note: This should only ever be called by {@link OSInAppMessageRepository#cleanCachedInAppMessages()}
188
187
* <br/><br/>
189
188
*
190
- * @see OneSignalCacheCleaner#cleanCachedInAppMessages(OneSignalDbHelper)
191
189
* @see OSInAppMessageRepository#cleanCachedInAppMessages()
192
190
*/
193
191
private void cleanInAppMessageClickedClickIds (Set <String > oldClickedClickIds ) {
You can’t perform that action at this time.
0 commit comments