Skip to content

Commit 0e930ab

Browse files
authored
feat(templates): update Boilerplate based on new Bswup changes #10904 (#10908)
1 parent 59b1b2e commit 0e930ab

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/ForceUpdateSnackBar.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@inherits AppComponentBase
22

3-
<BitSnackBar @ref=bitSnackBar AutoDismiss="false" OnDismiss="WrapHandled(OnDismiss)">
3+
<BitSnackBar @ref=bitSnackBar AutoDismiss="false" Persistent>
44
<TitleTemplate>
55
<BitText Typography="BitTypography.H5">@Localizer[nameof(AppStrings.ForceUpdateTitle)]</BitText>
66
</TitleTemplate>

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/ForceUpdateSnackBar.razor.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ public partial class ForceUpdateSnackBar
44
{
55
[AutoInject] private IAppUpdateService appUpdateService = default!;
66

7-
private BitSnackBar bitSnackBar = default!;
87

98
private Action? unsubscribe;
10-
private bool isVisible = false;
9+
private bool isShown = false;
10+
private BitSnackBar bitSnackBar = default!;
11+
1112

1213
protected override async Task OnInitAsync()
1314
{
@@ -17,21 +18,19 @@ protected override async Task OnInitAsync()
1718

1819
unsubscribe = PubSubService.Subscribe(ClientPubSubMessages.FORCE_UPDATE, async (_) =>
1920
{
20-
if (isVisible) return;
21-
isVisible = true;
21+
if (isShown) return;
22+
23+
isShown = true;
2224
await bitSnackBar.Show(string.Empty);
2325
});
2426
}
2527

28+
2629
private async Task Update()
2730
{
2831
await appUpdateService.ForceUpdate();
2932
}
3033

31-
private void OnDismiss()
32-
{
33-
isVisible = false;
34-
}
3534

3635
protected override async ValueTask DisposeAsync(bool disposing)
3736
{

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Scripts/app.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ class App {
7474
};
7575
};
7676
//#endif
77+
78+
public static forceUpdate() {
79+
(window as any).BitBswupProgress.config({ autoReload: true });
80+
(window as any).BitBswup.checkForUpdate();
81+
}
7782
}
7883

7984
(window as any).App = App;

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Components/AppBswupProgressBar.razor

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,10 @@
5252
#bit-bswup .bswup-progress-text::after {
5353
content: var(--bit-bswup-percent-text, "");
5454
}
55-
56-
#bit-bswup[style*="--bit-bswup-percent: 100"] {
57-
display: none !important;
58-
}
5955
</style>
6056

6157
<div>
62-
<BswupProgress AppContainer="#app-container" HideApp="false" AutoReload="false" ShowLogs="false">
58+
<BswupProgress AppContainer="#app-container" HideApp="false" AutoReload="false" ShowLogs="false" ShowAssets="false" AutoHide="true">
6359
<div class="bswup-progress-text" />
6460
<svg class="bswup-container">
6561
<circle r="40%" cx="50%" cy="50%" />

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Services/WebAppUpdateService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ public partial class WebAppUpdateService : IAppUpdateService
77

88
public async Task ForceUpdate()
99
{
10-
await jsRuntime.InvokeVoidAsync("BitBswup.forceRefresh"); // TODO: Replace this with `BitBswup.checkForUpdate` after next bswup pre-release.
10+
await jsRuntime.InvokeVoidAsync("App.forceUpdate");
1111
}
1212
}

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/index.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@
9393
#bit-bswup .bswup-progress-text::after {
9494
content: var(--bit-bswup-percent-text, "");
9595
}
96-
97-
#bit-bswup[style*="--bit-bswup-percent: 100"] {
98-
display: none !important;
99-
}
10096
</style>
10197
<style>
10298
.bit-lds-grid div {
@@ -210,8 +206,8 @@
210206
<script src="_content/Bit.Bswup/bit-bswup.js" blazorScript="_content/Bit.BlazorES2019/blazor.webassembly.js"></script>
211207
<script src="_content/Bit.Bswup/bit-bswup.progress.js"></script>
212208
<script>
213-
const autoReload = false, showLogs = false, showAssets = false, appContainer = '#app-container', hideApp = false, handler = null;
214-
startBswupProgress(autoReload, showLogs, showAssets, appContainer, hideApp, handler);
209+
const autoReload = false, showLogs = false, showAssets = false, appContainer = '#app-container', hideApp = false, autoHide = true, handler = null;
210+
BitBswupProgress.start(autoReload, showLogs, showAssets, appContainer, hideApp, autoHide, handler);
215211
</script>
216212
<script src="_content/Bit.Butil/bit-butil.js"></script>
217213
<!--#if (offlineDb == true) -->

0 commit comments

Comments
 (0)