Skip to content

Commit 71c0f85

Browse files
authored
fix(varcache): saveDiff and loadDiff exceptions LP-7621 (#115)
1 parent 072e157 commit 71c0f85

File tree

2 files changed

+46
-47
lines changed

2 files changed

+46
-47
lines changed

Leanplum-SDK/Classes/LPVarCache.m

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -511,60 +511,60 @@ + (void)applyVariableDiffs:(NSDictionary *)diffs_
511511
maybeDownloadFiles];
512512
}
513513
}
514-
}
515514

516-
// If LeanplumLocation is linked in, setup region monitoring.
517-
if (messages_ || regions_) {
518-
if (!regionInitBlock) {
519-
if ([LPConstantsState sharedState].isDevelopmentModeEnabled) {
520-
if ([regions_ count] > 0) {
521-
NSLog(@"Leanplum: Regions have been defined in dashboard, but the app is not built to handle them.");
522-
NSLog(@"Leanplum: Add LeanplumLocation.framework or LeanplumBeacon.framework to Build Settings -> Link Binary With Libraries.");
523-
NSLog(@"Leanplum: Disregard warning if there are no plans to utilize iBeacon or Geofencing within the app");
515+
// If LeanplumLocation is linked in, setup region monitoring.
516+
if (messages_ || regions_) {
517+
if (!regionInitBlock) {
518+
if ([LPConstantsState sharedState].isDevelopmentModeEnabled) {
519+
if ([regions_ count] > 0) {
520+
NSLog(@"Leanplum: Regions have been defined in dashboard, but the app is not built to handle them.");
521+
NSLog(@"Leanplum: Add LeanplumLocation.framework or LeanplumBeacon.framework to Build Settings -> Link Binary With Libraries.");
522+
NSLog(@"Leanplum: Disregard warning if there are no plans to utilize iBeacon or Geofencing within the app");
523+
}
524524
}
525-
}
526-
} else {
527-
NSSet *foregroundRegionNames;
528-
NSSet *backgroundRegionNames;
529-
[LPActionManager getForegroundRegionNames:&foregroundRegionNames
530-
andBackgroundRegionNames:&backgroundRegionNames];
531-
regionInitBlock([LPVarCache regions], foregroundRegionNames, backgroundRegionNames);
525+
} else {
526+
NSSet *foregroundRegionNames;
527+
NSSet *backgroundRegionNames;
528+
[LPActionManager getForegroundRegionNames:&foregroundRegionNames
529+
andBackgroundRegionNames:&backgroundRegionNames];
530+
regionInitBlock([LPVarCache regions], foregroundRegionNames, backgroundRegionNames);
531+
}
532532
}
533-
}
534-
535-
BOOL interfaceUpdated = NO;
536-
if (updateRules_) {
537-
interfaceUpdated = ![updateRules_ isEqual:updateRulesDiffs];
538-
updateRulesDiffs = [updateRules_ mutableCopy];
539-
[self downloadUpdateRulesImages];
540-
}
541-
542-
BOOL eventsUpdated = NO;
543-
if (eventRules_ && ![eventRules_ isKindOfClass:NSNull.class]) {
544-
eventsUpdated = ![eventRules_ isEqual:eventRulesDiffs];
545-
eventRulesDiffs = eventRules_;
546-
}
547-
548-
if (variants_) {
549-
variants = variants_;
550-
}
551-
552-
contentVersion++;
553533

554-
if (!silent) {
555-
[self saveDiffs];
556-
557-
hasReceivedDiffs = YES;
558-
if (updateBlock) {
559-
updateBlock();
534+
BOOL interfaceUpdated = NO;
535+
if (updateRules_) {
536+
interfaceUpdated = ![updateRules_ isEqual:updateRulesDiffs];
537+
updateRulesDiffs = [updateRules_ mutableCopy];
538+
[self downloadUpdateRulesImages];
560539
}
561540

562-
if (interfaceUpdated) {
563-
interfaceUpdateBlock();
541+
BOOL eventsUpdated = NO;
542+
if (eventRules_ && ![eventRules_ isKindOfClass:NSNull.class]) {
543+
eventsUpdated = ![eventRules_ isEqual:eventRulesDiffs];
544+
eventRulesDiffs = eventRules_;
545+
}
546+
547+
if (variants_) {
548+
variants = variants_;
564549
}
565550

566-
if (eventsUpdated) {
567-
eventsUpdateBlock();
551+
contentVersion++;
552+
553+
if (!silent) {
554+
[self saveDiffs];
555+
556+
hasReceivedDiffs = YES;
557+
if (updateBlock) {
558+
updateBlock();
559+
}
560+
561+
if (interfaceUpdated) {
562+
interfaceUpdateBlock();
563+
}
564+
565+
if (eventsUpdated) {
566+
eventsUpdateBlock();
567+
}
568568
}
569569
}
570570
}

Leanplum-SDK/Classes/LeanplumRequest.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ - (void)sendRequests:(BOOL)async
360360
}
361361
LP_END_TRY
362362

363-
364363
[LPEventCallbackManager invokeSuccessCallbacksOnResponses:json
365364
requests:requestsToSend
366365
operation:operation];

0 commit comments

Comments
 (0)