latestversionplugin
latestversionplugin copied to clipboard
Enhancement - Retrieve release notes from App Stores
If this issue is for a new feature, please skip the "Bug" section and fill out the "Feature Request" section at the bottom.
Feature Request
Description: In addition to retrieving the app's version number, add functionality to retrieve the app's release notes.
I've downloaded the source and added support for this to Android and iOS but I don't develop UWP apps. Here's what I came up with that works well with our app's release notes formatting:
Interface addition:
Task<string> GetLatestReleaseNotes();
Android release notes retrieval:
var content = responseMsg.Content == null ? null : await responseMsg.Content.ReadAsStringAsync();
var versionMatch = Regex.Match(content, "<div[^>]*>Current Version</div><span[^>]*><div[^>]*><span[^>]*>(.*?)<").Groups[1];
if (versionMatch.Success)
{
version = versionMatch.Value.Trim();
}
var releaseNotesMatch = Regex.Match(content, "<h2[^>]*>What's New</h2>.*<div.*itemprop=\"description\"[^>]*><span([^>]*>)(.+?)</span>").Groups[2];
if (releaseNotesMatch.Success)
{
var newLines = Environment.NewLine + Environment.NewLine;
releaseNotes = releaseNotesMatch.Value.Trim().Replace("<br><br>", newLines).Replace("<br>", newLines);
}
iOS release notes retrieval:
var http = new HttpClient();
var response = await http.GetAsync($"http://itunes.apple.com/lookup?bundleId={_bundleIdentifier}");
var content = response.Content == null ? null : await response.Content.ReadAsStringAsync();
var appLookup = JsonValue.Parse(content);
var newLines = Environment.NewLine + Environment.NewLine;
return new App
{
Version = appLookup["results"][0]["version"],
Url = appLookup["results"][0]["trackViewUrl"],
// Convert single line returns to double line returns without changing existing double line returns
ReleaseNotes = ((string)(appLookup["results"][0]["releaseNotes"])).Replace("\n\n", "<br>").Replace("\n", newLines).Replace("<br>", newLines)
};
I want this as well.
Any progress here? I'll create another nuget if we stuck here.