@@ -1028,7 +1028,7 @@ - (void)test_variables
10281028 [LPVar define: @" myArray" withArray: @[@1 , @2 , @3 , @4 , @5 ]];
10291029 [LPVar define: @" welcomeMessage" withString: @" Welcome to Leanplum!" ];
10301030
1031- [LPVarCache applyVariableDiffs:
1031+ [[ LPVarCache sharedCache ] applyVariableDiffs:
10321032 @{
10331033 @" B" : @{
10341034 @" a" : @{
@@ -1111,7 +1111,7 @@ - (void)test_variables
11111111 return YES ;
11121112 }];
11131113
1114- XCTAssertTrue ([LPVarCache sendVariablesIfChanged ]);
1114+ XCTAssertTrue ([[ LPVarCache sharedCache ] sendVariablesIfChanged ]);
11151115 [self waitForExpectationsWithTimeout: 2.0 handler: nil ];
11161116
11171117 // Test object for key path.
@@ -1137,28 +1137,28 @@ - (void)test_variables
11371137 XCTAssertEqualObjects (@2 , ([Leanplum objectForKeyPathComponents: @[@" D" , @" b" ]]));
11381138
11391139 // Test LPVarCache get variable.
1140- XCTAssertEqualObjects (@" Welcome to Leanplum!" , [[LPVarCache getVariable: @" welcomeMessage" ]
1140+ XCTAssertEqualObjects (@" Welcome to Leanplum!" , [[[ LPVarCache sharedCache ] getVariable: @" welcomeMessage" ]
11411141 defaultValue ]);
1142- XCTAssertNotNil ([LPVarCache getVariable: @" named" ]);
1143- XCTAssertEqual (10 , [[LPVarCache getVariable: @" int" ] intValue ]);
1144- XCTAssertEqual (10 .0f , [[LPVarCache getVariable: @" float" ] floatValue ]);
1145- XCTAssertEqual (10.0 , [[LPVarCache getVariable: @" double" ] doubleValue ]);
1146- XCTAssertEqual (YES , [[LPVarCache getVariable: @" bool" ] boolValue ]);
1147- XCTAssertEqual (10L , [[LPVarCache getVariable: @" long" ] longValue ]);
1148- XCTAssertEqual (@10 , [[LPVarCache getVariable: @" number" ] numberValue ]);
1149- XCTAssertEqual (5 .0f , [[LPVarCache getVariable: @" cgfloat" ] cgFloatValue ]);
1150- XCTAssertEqual (' c' , [[LPVarCache getVariable: @" char" ] charValue ]);
1151- XCTAssertEqual (100LL , [[LPVarCache getVariable: @" long_long" ] longLongValue ]);
1152- XCTAssertEqual (0x1 , [[LPVarCache getVariable: @" short" ] shortValue ]);
1153- XCTAssertEqual (5 , [[LPVarCache getVariable: @" unsigned_int" ] unsignedIntValue ]);
1154- XCTAssertEqual (NSUIntegerMax, [[LPVarCache getVariable: @" unsigned_integer" ]
1142+ XCTAssertNotNil ([[ LPVarCache sharedCache ] getVariable: @" named" ]);
1143+ XCTAssertEqual (10 , [[[ LPVarCache sharedCache ] getVariable: @" int" ] intValue ]);
1144+ XCTAssertEqual (10 .0f , [[[ LPVarCache sharedCache ] getVariable: @" float" ] floatValue ]);
1145+ XCTAssertEqual (10.0 , [[[ LPVarCache sharedCache ] getVariable: @" double" ] doubleValue ]);
1146+ XCTAssertEqual (YES , [[[ LPVarCache sharedCache ] getVariable: @" bool" ] boolValue ]);
1147+ XCTAssertEqual (10L , [[[ LPVarCache sharedCache ] getVariable: @" long" ] longValue ]);
1148+ XCTAssertEqual (@10 , [[[ LPVarCache sharedCache ] getVariable: @" number" ] numberValue ]);
1149+ XCTAssertEqual (5 .0f , [[[ LPVarCache sharedCache ] getVariable: @" cgfloat" ] cgFloatValue ]);
1150+ XCTAssertEqual (' c' , [[[ LPVarCache sharedCache ] getVariable: @" char" ] charValue ]);
1151+ XCTAssertEqual (100LL , [[[ LPVarCache sharedCache ] getVariable: @" long_long" ] longLongValue ]);
1152+ XCTAssertEqual (0x1 , [[[ LPVarCache sharedCache ] getVariable: @" short" ] shortValue ]);
1153+ XCTAssertEqual (5 , [[[ LPVarCache sharedCache ] getVariable: @" unsigned_int" ] unsignedIntValue ]);
1154+ XCTAssertEqual (NSUIntegerMax, [[[ LPVarCache sharedCache ] getVariable: @" unsigned_integer" ]
11551155 unsignedIntegerValue ]);
1156- XCTAssertEqual (200 , [[LPVarCache getVariable: @" unsigned_char" ] unsignedCharValue ]);
1157- XCTAssertEqual (50L , [[LPVarCache getVariable: @" unsigned_long" ] unsignedLongValue ]);
1158- XCTAssertEqual (25LL , [[LPVarCache getVariable: @" unsigned_long_long" ] unsignedLongLongValue ]);
1159- XCTAssertEqual (0x1 , [[LPVarCache getVariable: @" unsigned_short" ] unsignedShortValue ]);
1160- XCTAssertEqual (1 , [[LPVarCache getVariable: @" A" ] integerValue ]);
1161- XCTAssertEqual (2 , [[[LPVarCache getVariable: @" C" ] objectForKey: @" a" ] integerValue ]);
1156+ XCTAssertEqual (200 , [[[ LPVarCache sharedCache ] getVariable: @" unsigned_char" ] unsignedCharValue ]);
1157+ XCTAssertEqual (50L , [[[ LPVarCache sharedCache ] getVariable: @" unsigned_long" ] unsignedLongValue ]);
1158+ XCTAssertEqual (25LL , [[[ LPVarCache sharedCache ] getVariable: @" unsigned_long_long" ] unsignedLongLongValue ]);
1159+ XCTAssertEqual (0x1 , [[[ LPVarCache sharedCache ] getVariable: @" unsigned_short" ] unsignedShortValue ]);
1160+ XCTAssertEqual (1 , [[[ LPVarCache sharedCache ] getVariable: @" A" ] integerValue ]);
1161+ XCTAssertEqual (2 , [[[[ LPVarCache sharedCache ] getVariable: @" C" ] objectForKey: @" a" ] integerValue ]);
11621162
11631163 // default variables.
11641164 XCTAssertEqualObjects (@5.0 , [cgfloat_variable defaultValue ]);
@@ -1191,16 +1191,16 @@ - (void)testStartResponseShouldParseVariantDebugInfo
11911191 XCTAssertTrue (success);
11921192 [OHHTTPStubs removeStub: startStub];
11931193 // Then: variantDebugInfo should be parsed
1194- XCTAssertNotNil ([LPVarCache variantDebugInfo ]);
1195- NSDictionary *abTests = [LPVarCache variantDebugInfo ][@" abTests" ];
1194+ XCTAssertNotNil ([[ LPVarCache sharedCache ] variantDebugInfo ]);
1195+ NSDictionary *abTests = [[ LPVarCache sharedCache ] variantDebugInfo ][@" abTests" ];
11961196 XCTAssertEqual (abTests.count , 2 );
11971197
11981198 // Then: variantDebugInfo should be persisted
1199- [LPVarCache saveDiffs ];
1200- [LPVarCache setVariantDebugInfo: nil ];
1201- XCTAssertNil ([LPVarCache variantDebugInfo ]);
1202- [LPVarCache loadDiffs ];
1203- XCTAssertNotNil ([LPVarCache variantDebugInfo ]);
1199+ [[ LPVarCache sharedCache ] saveDiffs ];
1200+ [[ LPVarCache sharedCache ] setVariantDebugInfo: nil ];
1201+ XCTAssertNil ([[ LPVarCache sharedCache ] variantDebugInfo ]);
1202+ [[ LPVarCache sharedCache ] loadDiffs ];
1203+ XCTAssertNotNil ([[ LPVarCache sharedCache ] variantDebugInfo ]);
12041204 dispatch_semaphore_signal (semaphore);
12051205 }];
12061206 dispatch_semaphore_wait (semaphore, [LeanplumHelper default_dispatch_time ]);
@@ -1213,19 +1213,19 @@ - (void)testShouldPersistVariantDebugInfo
12131213{
12141214 // Given: a variantDebugInfo set in VarCache
12151215 NSDictionary *mockVariantDebugInfo = @{@" abTests" :@[]};
1216- [LPVarCache setVariantDebugInfo: mockVariantDebugInfo];
1216+ [[ LPVarCache sharedCache ] setVariantDebugInfo: mockVariantDebugInfo];
12171217 XCTAssertEqual ([Leanplum variantDebugInfo ].allKeys .count , 1 );
12181218
12191219 // When: the varcache is persisted
1220- [LPVarCache saveDiffs ];
1220+ [[ LPVarCache sharedCache ] saveDiffs ];
12211221 XCTAssertEqual ([Leanplum variantDebugInfo ].allKeys .count , 1 );
12221222
12231223
1224- [LPVarCache setVariantDebugInfo: nil ];
1224+ [[ LPVarCache sharedCache ] setVariantDebugInfo: nil ];
12251225 XCTAssertEqual ([Leanplum variantDebugInfo ].allKeys .count , 0 );
12261226
12271227 // Then: the variantDebugInfo can be loaded from disk
1228- [LPVarCache loadDiffs ];
1228+ [[ LPVarCache sharedCache ] loadDiffs ];
12291229 XCTAssertEqual ([Leanplum variantDebugInfo ].allKeys .count , 1 );
12301230}
12311231
@@ -1371,7 +1371,7 @@ - (void)test_metadata
13711371 @" whenTriggers" :@{},
13721372 }};
13731373 NSArray *variants = @[@{@" id" :@" 1" }, @{@" id" :@" 2" }];
1374- [LPVarCache applyVariableDiffs: nil messages: messages updateRules: nil
1374+ [[ LPVarCache sharedCache ] applyVariableDiffs: nil messages: messages updateRules: nil
13751375 eventRules: nil variants: variants regions: nil variantDebugInfo: nil ];
13761376
13771377 XCTAssertEqualObjects (variants, [Leanplum variants ]);
@@ -1420,15 +1420,15 @@ - (void)test_file_syncing
14201420 XCTAssertTrue ([plist[@" hash" ] length ] > 0 );
14211421 XCTAssertTrue ([plist[@" size" ] intValue ] > 0 );
14221422
1423- XCTAssertTrue ([[LPVarCache defaultKinds ][@" __Resources" ] isEqual: @" group" ]);
1424- XCTAssertTrue ([[LPVarCache defaultKinds ]
1423+ XCTAssertTrue ([[[ LPVarCache sharedCache ] defaultKinds ][@" __Resources" ] isEqual: @" group" ]);
1424+ XCTAssertTrue ([[[ LPVarCache sharedCache ] defaultKinds ]
14251425 [@" __Resources.PlugIns.Leanplum-SDK_Tests\\ .xctest.test\\ .file" ]
14261426 isEqual: @" file" ]);
14271427 return YES ;
14281428 }];
1429- [LPVarCache sendVariablesIfChanged ];
1429+ [[ LPVarCache sharedCache ] sendVariablesIfChanged ];
14301430
1431- NSDictionary *fileAttributes = [LPVarCache fileAttributes ];
1431+ NSDictionary *fileAttributes = [[ LPVarCache sharedCache ] fileAttributes ];
14321432 XCTAssertEqual (2 , fileAttributes.count );
14331433}
14341434
@@ -1533,7 +1533,7 @@ - (void)test_define_actions
15331533
15341534 // Define action and send it.
15351535 [Leanplum defineAction: action_name ofKind: kLeanplumActionKindAction withArguments: arguments];
1536- [LPVarCache sendActionsIfChanged ];
1536+ [[ LPVarCache sharedCache ] sendActionsIfChanged ];
15371537
15381538 // Test whether notification parsing is working correctly.
15391539 NSString *jsonString = [LeanplumHelper retrieve_string_from_file: @" sample_action_notification"
0 commit comments