Skip to content

Commit

Permalink
Tweak feedback defaults
Browse files Browse the repository at this point in the history
Most importantly includes the version of the app now
  • Loading branch information
danielchalmers committed Jan 12, 2024
1 parent 1017069 commit 9895cb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion JournalApp/Components/Dialogs/CustomMessageBox.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div class="@("d-flex align-center justify-space-between" + (ShowFeedbackLink ? " flex-grow-1" : ""))">
@if (ShowFeedbackLink)
{
<MudLink Href="@(FeedbackService.GenerateLink(body: Message))" Typo="Typo.subtitle2">Send feedback...</MudLink>
<MudLink Href="@(FeedbackService.GenerateLink(body: $"\"{Message}\""))" Typo="Typo.subtitle2">Send feedback...</MudLink>
}

<div tabindex="-1" @onkeydown="HandleKeyDown">
Expand Down
13 changes: 4 additions & 9 deletions JournalApp/Data/FeedbackService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ public static class FeedbackService
public static string GenerateLink(string subject = null, string body = null)
{
var deviceInfo = DeviceInfo.Current;
var deviceInfoString = $"{ThisAssembly.AssemblyInformationalVersion} | {deviceInfo.Platform} {deviceInfo.VersionString} | {deviceInfo.Manufacturer} {deviceInfo.Model}";

var finalSubject = "JournalApp: ";
subject = "JournalApp: " + subject;

if (!string.IsNullOrWhiteSpace(subject))
finalSubject += subject;
body += "%0D%0A" + deviceInfoString + "%0D%0A";

var finalBody = $"{deviceInfo.Platform} {deviceInfo.VersionString}%0D%0A{deviceInfo.Manufacturer} {deviceInfo.Model}%0D%0A%0D%0A";

if (!string.IsNullOrWhiteSpace(body))
finalBody += body;

return $"mailto:{Email}?subject={finalSubject}&body={finalBody}".Replace(" ", "%20");
return $"mailto:{Email}?subject={subject}&body=%0D%0A{body}".Replace(" ", "%20");
}
}

0 comments on commit 9895cb3

Please sign in to comment.