Skip to content

Commit e121504

Browse files
authored
Appcenter fixes for 2.3.5 (#9667)
1 parent 19f749c commit e121504

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/Files.Shared/Extensions/LinqExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ public static class LinqExtensions
4242
return defaultValue;
4343
}
4444

45-
public static async Task<TValue?> GetAsync<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<Task<TValue?>> defaultValueFunc)
45+
public static Task<TValue?> GetAsync<TKey, TValue>(this IDictionary<TKey, Task<TValue?>> dictionary, TKey key, Func<Task<TValue?>> defaultValueFunc)
4646
{
4747
if (dictionary is null || key is null)
4848
{
49-
return await defaultValueFunc();
49+
return defaultValueFunc();
5050
}
5151
if (!dictionary.ContainsKey(key))
5252
{
53-
var defaultValue = await defaultValueFunc();
54-
if (defaultValue is TValue value)
53+
var defaultValue = defaultValueFunc();
54+
if (defaultValue is Task<TValue?> value)
5555
{
5656
dictionary.Add(key, value);
5757
}

src/Files.Uwp/Filesystem/StorageItems/ZipStorageFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ private IAsyncOperation<SevenZipExtractor> OpenZipFileAsync(bool openProtected =
468468
{
469469
return AsyncInfo.Run<SevenZipExtractor>(async (cancellationToken) =>
470470
{
471-
return new SevenZipExtractor(await OpenZipFileAsync(FileAccessMode.Read, openProtected));
471+
var zipFile = await OpenZipFileAsync(FileAccessMode.Read, openProtected);
472+
return zipFile is not null ? new SevenZipExtractor(zipFile) : null;
472473
});
473474
}
474475

src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static bool IsZipPath(string path, bool includeRoot = true)
7676
return (marker == path.Length && includeRoot) || (marker < path.Length && path[marker] is '\\');
7777
}
7878

79-
private static Dictionary<string, bool> defaultAppDict = new Dictionary<string, bool>();
79+
private static Dictionary<string, Task<bool>> defaultAppDict = new Dictionary<string, Task<bool>>();
8080
public static async Task<bool> CheckDefaultZipApp(string filePath)
8181
{
8282
Func<Task<bool>> queryFileAssoc = async () =>
@@ -487,7 +487,8 @@ private IAsyncOperation<SevenZipExtractor> OpenZipFileAsync()
487487
{
488488
return AsyncInfo.Run<SevenZipExtractor>(async (cancellationToken) =>
489489
{
490-
return new SevenZipExtractor(await OpenZipFileAsync(FileAccessMode.Read));
490+
var zipFile = await OpenZipFileAsync(FileAccessMode.Read);
491+
return zipFile is not null ? new SevenZipExtractor(zipFile) : null;
491492
});
492493
}
493494

src/Files.Uwp/UserControls/Menus/FileTagsContextMenu.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ private static void RemoveFileTag(List<ListedItem> selectedListedItems, FileTagV
5757
var existingTags = selectedItem.FileTags ?? Array.Empty<string>();
5858
if (existingTags.Contains(removed.Uid))
5959
{
60-
selectedItem.FileTags = existingTags.Except(new[] { removed.Uid }).ToArray();
60+
var tagList = existingTags.Except(new[] { removed.Uid }).ToArray();
61+
selectedItem.FileTags = tagList.Any() ? tagList : null;
6162
}
6263
}
6364
}

0 commit comments

Comments
 (0)