Skip to content

Commit

Permalink
Fix #6 - Improved account account experience (#22)
Browse files Browse the repository at this point in the history
* Improved the reliability of automatic icon detection

* Added a menu to change the icon of an account

* Fixed a bug where an editing account would prompt a message for discarding unsaved changes if UI is locked when closing the app.
  • Loading branch information
veler authored Aug 23, 2020
1 parent 4e55324 commit 03bb6b0
Show file tree
Hide file tree
Showing 35 changed files with 1,030 additions and 235 deletions.
8 changes: 8 additions & 0 deletions ServicesKeys-sample.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ RiteKitClientId:my client id



# -----------------------------------------------------------------------------------------
# Microsoft Azure API key. Used for Bing Entity Search
# -----------------------------------------------------------------------------------------

MicrosoftAzure:my api key



# -----------------------------------------------------------------------------------------
# Email address used for sending logs
# -----------------------------------------------------------------------------------------
Expand Down
31 changes: 28 additions & 3 deletions ThirdPartyNotices.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ This project incorporates components from the projects listed below. The origina
4. micjahn/ZXing.Net version 0.16.5 (https://github.com/micjahn/ZXing.Net)
5. Microsoft.Graph version 3.5.0 (https://github.com/microsoftgraph/msgraph-sdk-dotnet)
6. Microsoft.Identity.Client version 4.13.0 (https://github.com/AzureAD/microsoft-authentication-library-for-dotnet)
7. an-array-of-english-words (https://github.com/words/an-array-of-english-words)
8. an-array-of-spanish-words (https://github.com/words/an-array-of-spanish-words)
9. an-array-of-french-words (https://github.com/words/an-array-of-french-words)
7. WriteableBitmapEx 1.6.7 (https://github.com/reneschulte/WriteableBitmapEx)
8. an-array-of-english-words (https://github.com/words/an-array-of-english-words)
9. an-array-of-spanish-words (https://github.com/words/an-array-of-spanish-words)
10. an-array-of-french-words (https://github.com/words/an-array-of-french-words)
11. DropBox's Zxcvbn (https://github.com/bitbeans/zxcvbn-cs)
12. DropBox API 4.10.0.0 (https://github.com/dropbox/dropbox-sdk-dotnet)
13. Dinosaur icon made by Freepik perfect from www.flaticon.com (https://www.flaticon.com/authors/freepik)
Expand Down Expand Up @@ -376,6 +377,30 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

%% WriteableBitmapEx NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)

Copyright (c) 2009-2015 Rene Schulte

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

%% an-array-of-english-words NOTICES AND INFORMATION BEGIN HERE
=========================================
(The MIT License)
Expand Down
4 changes: 2 additions & 2 deletions Windows/Def/PaZword.Api/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2020.7.7.1")]
[assembly: AssemblyFileVersion("2020.7.7.1")]
[assembly: AssemblyVersion("2020.8.23.3")]
[assembly: AssemblyFileVersion("2020.8.23.3")]

6 changes: 6 additions & 0 deletions Windows/Def/PaZword.Api/Services/IIconService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ namespace PaZword.Api.Services
/// </summary>
public interface IIconService
{
/// <summary>
/// Prompts the user a file open picker to select an image document.
/// </summary>
/// <returns>A Base64 representation of the selected image. If no image is selected, an empty string is returned.</returns>
Task<string> PickUpIconFromLocalFileAsync(CancellationToken cancellationToken);

/// <summary>
/// Tries to find an icon online that corresponds to a given <paramref name="entityName"/> or <paramref name="url"/>.
/// </summary>
Expand Down
4 changes: 3 additions & 1 deletion Windows/Impl/PaZword.Core/Data/SerializationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,19 @@ public async Task<string> WritableBitmapToBase64Async(WriteableBitmap bitmap, Ca
using (var memoryStream = new InMemoryRandomAccessStream())
{
BitmapEncoder encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, memoryStream);
cancellationToken.ThrowIfCancellationRequested();

using (SoftwareBitmap softwareBitmap = SoftwareBitmap.CreateCopyFromBuffer(bitmap.PixelBuffer, BitmapPixelFormat.Rgba8, bitmap.PixelWidth, bitmap.PixelHeight))
{
encoder.SetSoftwareBitmap(softwareBitmap);
await encoder.FlushAsync();
cancellationToken.ThrowIfCancellationRequested();
}

var bytes = new byte[memoryStream.Size];
using (Stream stream = memoryStream.AsStream())
{
await stream.ReadAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
await stream.ReadAsync(bytes, 0, bytes.Length, cancellationToken).ConfigureAwait(false);
}

return Convert.ToBase64String(bytes);
Expand Down
12 changes: 11 additions & 1 deletion Windows/Impl/PaZword.Core/PaZword.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,16 @@
<Compile Include="Security\PasswordStrengthEvaluator\Utility.cs" />
<Compile Include="Security\PasswordStrengthEvaluator\Zxcvbn.cs" />
<Compile Include="Services\Dropbox\DropboxStorageProvider.cs" />
<Compile Include="Services\IconService.cs" />
<Compile Include="Services\Icons\BingEntitySearch.cs" />
<Compile Include="Services\Icons\Bing\BingEntitySearchResponse.cs" />
<Compile Include="Services\Icons\Bing\Entities.cs" />
<Compile Include="Services\Icons\Bing\Image.cs" />
<Compile Include="Services\Icons\Bing\Provider.cs" />
<Compile Include="Services\Icons\Bing\ValueElement.cs" />
<Compile Include="Services\Icons\FaviconFinder.cs" />
<Compile Include="Services\Icons\Favicon\FaviconFinderResponse.cs" />
<Compile Include="Services\Icons\Favicon\Icon.cs" />
<Compile Include="Services\Icons\IconService.cs" />
<Compile Include="Services\RecurrentTaskService.cs" />
<Compile Include="Services\RecurrentTasks\InactivityDetectionRecurrentTask.cs" />
<Compile Include="Services\RecurrentTasks\RequestRateAndReviewRecurrentTask.cs" />
Expand Down Expand Up @@ -114,6 +123,7 @@
<PackageReference Include="Microsoft.Identity.Client" Version="4.13.0" />
<PackageReference Include="ZXing.Net" Version="0.16.5" />
<PackageReference Include="ksemenenko.ColorThief" Version="1.1.1.4" />
<PackageReference Include="WriteableBitmapEx" Version="1.6.7" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Windows/Impl/PaZword.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2020.7.7.3")]
[assembly: AssemblyFileVersion("2020.7.7.3")]
[assembly: AssemblyVersion("2020.8.23.3")]
[assembly: AssemblyFileVersion("2020.8.23.3")]

[assembly: InternalsVisibleTo("PaZword.Tests")]

173 changes: 0 additions & 173 deletions Windows/Impl/PaZword.Core/Services/IconService.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace PaZword.Core.Services.Icons.Bing
{
internal sealed class BingEntitySearchResponse
{
[JsonProperty("entities")]
public Entities Entities { get; set; }
}
}
10 changes: 10 additions & 0 deletions Windows/Impl/PaZword.Core/Services/Icons/Bing/Entities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace PaZword.Core.Services.Icons.Bing
{
internal sealed class Entities
{
[JsonProperty("value")]
public ValueElement[] Value { get; set; }
}
}
14 changes: 14 additions & 0 deletions Windows/Impl/PaZword.Core/Services/Icons/Bing/Image.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Newtonsoft.Json;
using System;

namespace PaZword.Core.Services.Icons.Bing
{
internal sealed class Image
{
[JsonProperty("provider")]
public Provider[] Provider { get; set; }

[JsonProperty("hostPageUrl")]
public Uri HostPageUrl { get; set; }
}
}
14 changes: 14 additions & 0 deletions Windows/Impl/PaZword.Core/Services/Icons/Bing/Provider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Newtonsoft.Json;
using System;

namespace PaZword.Core.Services.Icons.Bing
{
internal sealed class Provider
{
[JsonProperty("_type")]
public string Type { get; set; }

[JsonProperty("url")]
public Uri Url { get; set; }
}
}
14 changes: 14 additions & 0 deletions Windows/Impl/PaZword.Core/Services/Icons/Bing/ValueElement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Newtonsoft.Json;
using System;

namespace PaZword.Core.Services.Icons.Bing
{
internal sealed class ValueElement
{
[JsonProperty("image")]
public Image Image { get; set; }

[JsonProperty("url")]
public Uri Url { get; set; }
}
}
Loading

0 comments on commit 03bb6b0

Please sign in to comment.