Skip to content

Commit 2f782c6

Browse files
lan17alexisoyama
authored andcommitted
feat(websocket): Add applyVars in socket. (#77)
This is required for LP2 to preview variable change instantly on device.
1 parent 25b0c77 commit 2f782c6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Leanplum-SDK/Classes/LeanplumSocket.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ - (void)socketIO:(Leanplum_SocketIO *)socketIO didReceiveEvent:(Leanplum_SocketI
202202
cancelButtonTitle:NSLocalizedString(@"OK", nil)
203203
otherButtonTitles:nil
204204
block:nil];
205+
} else if ([packet.name isEqualToString:@"applyVars"]) {
206+
NSDictionary *packetData = packet.dataAsJSON[@"args"][0];
207+
[LPVarCache applyVariableDiffs:packetData messages:nil updateRules:nil eventRules:nil
208+
variants:nil regions:nil];
205209
}
206210
LP_END_TRY
207211
}

0 commit comments

Comments
 (0)