File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed
LeanplumSDK/LeanplumSDK/Classes Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -2350,12 +2350,21 @@ + (void)forceContentUpdate
23502350}
23512351
23522352+ (void )forceContentUpdate : (LeanplumVariablesChangedBlock)block
2353+ {
2354+ [Leanplum forceContentUpdateWithBlock: ^(BOOL success) {
2355+ if (block) {
2356+ block ();
2357+ }
2358+ }];
2359+ }
2360+
2361+ + (void )forceContentUpdateWithBlock : (LeanplumForceContentUpdateBlock)updateBlock
23532362{
23542363 [[LPCountAggregator sharedAggregator ] incrementCount: @" force_content_update" ];
23552364
23562365 if (IS_NOOP) {
2357- if (block ) {
2358- block ( );
2366+ if (updateBlock ) {
2367+ updateBlock ( NO );
23592368 }
23602369 return ;
23612370 }
@@ -2405,13 +2414,13 @@ + (void)forceContentUpdate:(LeanplumVariablesChangedBlock)block
24052414 [[self inbox ] triggerInboxSyncedWithStatus: YES withCompletionHandler: nil ];
24062415 }
24072416 LP_END_TRY
2408- if (block ) {
2409- block ( );
2417+ if (updateBlock ) {
2418+ updateBlock ( YES );
24102419 }
24112420 }];
24122421 [request onError: ^(NSError *error) {
2413- if (block ) {
2414- block ( );
2422+ if (updateBlock ) {
2423+ updateBlock ( NO );
24152424 }
24162425 [[self inbox ] triggerInboxSyncedWithStatus: NO withCompletionHandler: nil ];
24172426 }];
Original file line number Diff line number Diff line change 2727NS_ASSUME_NONNULL_BEGIN
2828
2929typedef void (^LeanplumVariablesChangedBlock)(void );
30+ typedef void (^LeanplumForceContentUpdateBlock)(BOOL success);
3031
3132@class LPVar;
3233
Original file line number Diff line number Diff line change @@ -703,6 +703,15 @@ NS_SWIFT_UNAVAILABLE("use forceContentUpdate(completion:)");
703703 */
704704+ (void )forceContentUpdate : (nullable LeanplumVariablesChangedBlock)block ;
705705
706+ /* *
707+ * Forces content to update from the server. If variables have changed, the
708+ * appropriate callbacks will fire. Use sparingly as if the app is updated,
709+ * you'll have to deal with potentially inconsistent state or user experience.
710+ * The provided callback has a boolean flag whether the update was successful or not. The callback fires regardless
711+ * of whether the variables have changed.
712+ */
713+ + (void )forceContentUpdateWithBlock : (LeanplumForceContentUpdateBlock)updateBlock ;
714+
706715/* *
707716 * This should be your first statement in a unit test. This prevents
708717 * Leanplum from communicating with the server.
You can’t perform that action at this time.
0 commit comments