Skip to content

Commit cbaa1dc

Browse files
committed
- Updated the Check-in Configuration Settings and Schedule Builder blocks to share the same logic when refreshing connected kiosk devices, after configuration changes are made.
1 parent db7d8f6 commit cbaa1dc

2 files changed

Lines changed: 39 additions & 16 deletions

File tree

Rock.Blocks/CheckIn/CheckInScheduleBuilder.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,7 @@ public BlockActionResult Save( List<GroupLocationsBag> scheduledLocations )
264264

265265
if ( RockContext.SaveChanges() > 0 )
266266
{
267-
#if NET472_OR_GREATER
268-
// Temporary until legacy check-in is removed.
269-
KioskDevice.Clear();
270-
#endif
267+
RefreshConnectedKiosks();
271268
}
272269

273270
return ActionOk();
@@ -703,6 +700,24 @@ private List<GroupLocationsBag> GetGroupLocationSchedules( IQueryable<GroupLocat
703700
return bags;
704701
}
705702

703+
/// <summary>
704+
/// Clears the kiosk device cache and pushes a refresh notification to all connected kiosks so configuration
705+
/// changes propagate without waiting for an app recycle.
706+
/// </summary>
707+
private void RefreshConnectedKiosks()
708+
{
709+
#if NET472_OR_GREATER
710+
// Temporary until legacy check-in is removed.
711+
KioskDevice.Clear();
712+
#endif
713+
714+
// I know, this is a terrible hack. But we need to force the
715+
// kiosks to refresh and we don't want to make this public yet. -dsh
716+
typeof( GroupType ).Assembly.GetType( "Rock.CheckIn.v2.CheckInDirector" )
717+
?.GetMethod( "SendRefreshKioskConfiguration" )
718+
?.Invoke( null, new object[0] );
719+
}
720+
706721
#endregion Private Methods
707722
}
708723
}

Rock.Blocks/CheckIn/Configuration/CheckInConfigurationSettings.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -650,15 +650,7 @@ public BlockActionResult Save( ValidPropertiesBox<CheckInConfigurationSettingsBa
650650
entity.SaveAttributeValues( RockContext );
651651
} );
652652

653-
// Invalidate the kiosk device cache and push a refresh notification to all connected kiosks so
654-
// configuration changes propagate without waiting for an app recycle. Mirrors the legacy
655-
// WebForms block; the reflection call into Rock.CheckIn.v2.CheckInDirector matches the legacy
656-
// approach (the API is intentionally still internal).
657-
Rock.CheckIn.KioskDevice.Clear();
658-
659-
typeof( GroupType ).Assembly.GetType( "Rock.CheckIn.v2.CheckInDirector" )
660-
?.GetMethod( "SendRefreshKioskConfiguration" )
661-
?.Invoke( null, new object[0] );
653+
RefreshConnectedKiosks();
662654

663655
if ( isNew )
664656
{
@@ -710,9 +702,7 @@ public BlockActionResult Delete( string key )
710702
entityService.Delete( entity );
711703
RockContext.SaveChanges();
712704

713-
// Invalidate the kiosk device cache so the deleted configuration is no longer served to any
714-
// connected kiosks. Mirrors the legacy WebForms block.
715-
Rock.CheckIn.KioskDevice.Clear();
705+
RefreshConnectedKiosks();
716706

717707
var pageRef = new Rock.Web.PageReference( PageCache.Id );
718708
var routeId = PageCache.PageRoutes.FirstOrDefault()?.Id;
@@ -1326,6 +1316,24 @@ private bool ValidateGroupType( GroupType groupType, out string errorMessage )
13261316
return true;
13271317
}
13281318

1319+
/// <summary>
1320+
/// Clears the kiosk device cache and pushes a refresh notification to all connected kiosks so configuration
1321+
/// changes propagate without waiting for an app recycle.
1322+
/// </summary>
1323+
private void RefreshConnectedKiosks()
1324+
{
1325+
#if NET472_OR_GREATER
1326+
// Temporary until legacy check-in is removed.
1327+
KioskDevice.Clear();
1328+
#endif
1329+
1330+
// I know, this is a terrible hack. But we need to force the
1331+
// kiosks to refresh and we don't want to make this public yet. -dsh
1332+
typeof( GroupType ).Assembly.GetType( "Rock.CheckIn.v2.CheckInDirector" )
1333+
?.GetMethod( "SendRefreshKioskConfiguration" )
1334+
?.Invoke( null, new object[0] );
1335+
}
1336+
13291337
#endregion Private Methods
13301338
}
13311339
}

0 commit comments

Comments
 (0)