@@ -247,34 +247,37 @@ - (void)updateInAppMessagesFromCache {
247
247
}
248
248
249
249
- (void )getInAppMessagesFromServer : (NSString *)subscriptionId {
250
- [OneSignalLog onesignalLog: ONE_S_LL_VERBOSE message: @" getInAppMessagesFromServer" ];
250
+ dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
251
+ [OneSignalLog onesignalLog: ONE_S_LL_VERBOSE message: @" getInAppMessagesFromServer" ];
251
252
252
- if (!subscriptionId) {
253
- [self updateInAppMessagesFromCache ];
254
- return ;
255
- }
253
+ if (!subscriptionId) {
254
+ [self updateInAppMessagesFromCache ];
255
+ return ;
256
+ }
256
257
257
- OSConsistencyManager *consistencyManager = [OSConsistencyManager shared ];
258
- NSString *onesignalId = OneSignalUserManagerImpl.sharedInstance .onesignalId ;
258
+ OSConsistencyManager *consistencyManager = [OSConsistencyManager shared ];
259
+ NSString *onesignalId = OneSignalUserManagerImpl.sharedInstance .onesignalId ;
259
260
260
- if (!onesignalId) {
261
- [OneSignalLog onesignalLog: ONE_S_LL_VERBOSE message: @" Failed to get in app messages due to no OneSignal ID" ];
262
- return ;
263
- }
261
+ if (!onesignalId) {
262
+ [OneSignalLog onesignalLog: ONE_S_LL_VERBOSE message: @" Failed to get in app messages due to no OneSignal ID" ];
263
+ return ;
264
+ }
264
265
265
- OSIamFetchReadyCondition *condition = [OSIamFetchReadyCondition sharedInstanceWithId: onesignalId];
266
- NSString *rywToken = [consistencyManager registerCondition: condition forId: onesignalId];
266
+ OSIamFetchReadyCondition *condition = [OSIamFetchReadyCondition sharedInstanceWithId: onesignalId];
267
+ NSString *rywToken = [consistencyManager registerCondition: condition forId: onesignalId];
267
268
268
- NSNumber *sessionDuration = @([OSSessionManager getTimeFocusedElapsed ]);
269
+ NSNumber *sessionDuration = @([OSSessionManager getTimeFocusedElapsed ]);
269
270
270
- // Initial request
271
- [self attemptFetchWithRetries: subscriptionId
272
- rywToken: rywToken
273
- sessionDuration: sessionDuration
274
- attempts: @0 // Starting with 0 attempts
275
- retryLimit: nil ]; // Retry limit to be set dynamically on first failure
271
+ // Initial request
272
+ [self attemptFetchWithRetries: subscriptionId
273
+ rywToken: rywToken
274
+ sessionDuration: sessionDuration
275
+ attempts: @0 // Starting with 0 attempts
276
+ retryLimit: nil ]; // Retry limit to be set dynamically on first failure
277
+ });
276
278
}
277
279
280
+
278
281
- (void )attemptFetchWithRetries : (NSString *)subscriptionId
279
282
rywToken : (NSString *)rywToken
280
283
sessionDuration : (NSNumber *)sessionDuration
0 commit comments