Skip to content

Commit

Permalink
Feature/update nuget 1 2 4 (#181)
Browse files Browse the repository at this point in the history
## Target
<!--
  Why are you making this change?
 -->

#### Open Questions
<!-- OPTIONAL
- [ ] Use the GitHub checklists to spark discussion on issues that may
arise from your approach. Please tick the box and explain your answer.
-->

## Checklist
<!--
It serves as a gentle reminder for common tasks. Confirm it's done and
check everything that applies.
-->
- [ ] Documentation updated
- [x] Tests cover new or modified code
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] New dependencies added
- [x] Includes breaking changes
- [x] Version bumped

## Visuals
<!-- OPTIONAL
Show results both before and after this change. When the output changes,
it can be a screenshot of a trace, metric, or log illustrating the
change.
-->

---------

Co-authored-by: ColdForeign <[email protected]>
Co-authored-by: George Radchuk <[email protected]>
  • Loading branch information
3 people authored Jul 24, 2023
1 parent dbd7c43 commit 962175f
Show file tree
Hide file tree
Showing 15 changed files with 683 additions and 306 deletions.
1 change: 0 additions & 1 deletion src/Cropper.Blazor/Client/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<MudThemeProvider Theme="@LayoutService.CurrentTheme" IsDarkMode="@LayoutService.IsDarkMode" IsDarkModeChanged="LayoutService.SetDarkMode" />
<MudSnackbarProvider />
<MudDialogProvider />
<UpdateAvailableDetector />

<MudLayout Class="cropperblazor-landingpage">
<MudAppBar Class="appbar" Elevation="25">
Expand Down
2 changes: 1 addition & 1 deletion src/Cropper.Blazor/Client/Shared/MainLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
}
InvokeAsync(StateHasChanged);
}, new MudBlazor.Services.ResizeOptions
}, new ResizeOptions
{
ReportRate = 50,
NotifyOnBreakpointOnly = false,
Expand Down

This file was deleted.

45 changes: 0 additions & 45 deletions src/Cropper.Blazor/Client/Shared/UpdateAvailableDetector.razor.cs

This file was deleted.

35 changes: 31 additions & 4 deletions src/Cropper.Blazor/Client/wwwroot/service-worker.published.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,30 @@
// offline support. See https://aka.ms/blazor-offline-considerations

self.importScripts('./service-worker-assets.js');
self.addEventListener('install', event => event.waitUntil(onInstall(event)));
self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
self.addEventListener('install', event => {
event.waitUntil(
Promise.all([
onInstall(),
self.skipWaiting(),
])
);
});
self.addEventListener('activate', event => {
event.waitUntil(
Promise.all(
[
onActivate(),
self.clients.claim(),
self.skipWaiting(),
]
)
.catch(
(err) => {
event.skipWaiting();
}
)
);
});
self.addEventListener('fetch', event => event.respondWith(onFetch(event)));

const cacheNamePrefix = 'offline-cache-';
Expand All @@ -18,8 +40,13 @@ async function onInstall(event) {
const assetsRequests = self.assetsManifest.assets
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
.map(asset => new Request(asset.url, {integrity: asset.hash, cache: 'no-cache'}));
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
.map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' }));

await caches.open(cacheName)
.then(cache => cache.addAll(assetsRequests))
.then(() => {
return self.skipWaiting();
});
}

async function onActivate(event) {
Expand Down
8 changes: 0 additions & 8 deletions src/Cropper.Blazor/Client/wwwroot/sw-registrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,3 @@ window.updateAvailable = new Promise((resolve, reject) => {
reject(error);
});
});

window.registerForUpdateAvailableNotification = (caller, methodName) => {
window.updateAvailable.then(isUpdateAvailable => {
if (isUpdateAvailable) {
caller.invokeMethodAsync(methodName).then();
}
});
};

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void Verify_Cropper_Service_Is_Registered(CropperJsInteropOptions? croppe
// assert
ServiceCollectionMock = new(ServiceCollection);
ServiceCollectionMock.ContainsSingletonService<ICropperJsInteropOptions, CropperJsInteropOptions>();
ServiceCollectionMock.TryContainsTransientService<ICropperJsInterop, CropperJsInterop>();
ServiceCollectionMock.TryContainsScopedService<ICropperJsInterop, CropperJsInterop>();
}

public static IEnumerable<object[]> TestData_AddCropper_Service()
Expand Down
Loading

0 comments on commit 962175f

Please sign in to comment.