v2.4.0
版本发布时间: 2021-06-23 16:44:03
roubachof/Sharpnado.TaskLoaderView最新发布版本:v2.5.1(2022-06-23 23:22:10)
Semantic change
As of 2.4.0, considering the following scenario:
- You start to load a task using the Load command
- Then a second load is asked by calling the Load command while the first load hasn't finished yet
Then the result of the first load will be discarded and the second load will take priority.
BREAKING CHANGES
The task source given to TaskLoaderNotifier
is now a Func<bool, Task>
(or a Func<bool, Task<T>>
) instead of a Func<Task>
.
You can simply change your calls from Loader.Load(() => InitializeAsync())
to Loader.Load(_ => InitializeAsync())
The boolean passed now to your task source is a boolean indicating if the notifier is refreshing.
You can use it for invalidating your cache for example.
Loader.Load(LoadItems);
public Task LoadItems(bool isRefreshing)
{
if (isRefreshing || !_cache.ContainsItems())
{
_cache.InvalidateItems();
var items = _httpService.GetItems()
_cache.PutItems(items);
return items;
}
return _cache.GetItems();
}
When the RefreshCommand
will be called, it will pass automatically the isRefreshing boolean set to true to your task source.
Fixes
- Fix Snackbar
BackgroundColor
andCompositeLoader
behavior.
1、 Sharpnado.TaskLoaderView.2.4.0.nupkg 31.95KB
2、 Sharpnado.TaskLoaderView.2.4.0.snupkg 16.86KB