diff --git a/src/OnePeek.Api/AppRatingEndpoint.cs b/src/OnePeek.Api/AppRatingEndpoint.cs index f26c2ef..2e05d33 100644 --- a/src/OnePeek.Api/AppRatingEndpoint.cs +++ b/src/OnePeek.Api/AppRatingEndpoint.cs @@ -18,7 +18,7 @@ namespace OnePeek.Api /// Culture of the query (returns location specific metadata + ratings). /// Sorting criteria. /// - public async Task GetReviews(string appId, StoreType store, StoreCultureType storeCulture, StoreReviewSorting sorting) + public async Task GetReviews(string appId, StoreType store, StoreCultureType storeCulture, StoreReviewSorting sorting, string prevPageMarkerId = null, string nextPageMarkerId = null) { if (storeCulture == StoreCultureType.Unknown) { @@ -26,7 +26,7 @@ namespace OnePeek.Api } string xml = await ApiHttpClient.Instance.Get( - EndpointUris.GetWindowsPhoneReviewsUri(appId, storeCulture.ToString(), sorting.ToString()) + EndpointUris.GetWindowsPhoneReviewsUri(appId, storeCulture.ToString(), sorting.ToString(), prevPageMarkerId, nextPageMarkerId) ); IEnumerable xel = XDocument.Parse(xml).Elements().First().Descendants(); diff --git a/src/OnePeek.Api/EndpointUris.cs b/src/OnePeek.Api/EndpointUris.cs index 8c9e0f1..2907289 100644 --- a/src/OnePeek.Api/EndpointUris.cs +++ b/src/OnePeek.Api/EndpointUris.cs @@ -28,18 +28,29 @@ namespace OnePeek.Api - internal static Uri GetWindowsPhoneReviewsUri(string appId, string culture, string orderBy) + internal static Uri GetWindowsPhoneReviewsUri(string appId, string culture, string orderBy, string prevPageMarkerId = null, string nextPageMarkerId = null) { culture = culture.Replace('_', '-'); string country = culture.Split('-')[1]; - return Uri(WINDOWSPHONE_REVIEWS_URI, appId, country, culture, orderBy); + string affix = String.Empty; + + if (!String.IsNullOrWhiteSpace(prevPageMarkerId)) + { + affix = "&beforeMarker=" + prevPageMarkerId; + } + else if (!String.IsNullOrWhiteSpace(nextPageMarkerId)) + { + affix = "&afterMarker=" + nextPageMarkerId; + } + + return Uri(WINDOWSPHONE_REVIEWS_URI + affix, appId, country, culture, orderBy); } private static Uri Uri(string template, params string[] replacements) { - string uriString = String.Format(template, replacements).ToLower(); + string uriString = String.Format(template, replacements); return new Uri(uriString, UriKind.Absolute); } } diff --git a/src/OnePeek.Api/Utils.cs b/src/OnePeek.Api/Utils.cs index 4d42158..39ebb50 100644 --- a/src/OnePeek.Api/Utils.cs +++ b/src/OnePeek.Api/Utils.cs @@ -19,8 +19,8 @@ namespace OnePeek.Api return null; } - Match match = new Regex(queryKey + @"=([A-Za-z0-9\-=]+)").Match(attr.Value); - return match.Success ? match.Groups[1].Value + "=" : null; + Match match = new Regex(queryKey + @"=([A-Za-z0-9\-\=]+)").Match(attr.Value); + return match.Success ? match.Groups[1].Value : null; } } } diff --git a/src/OnePeek.WebConsole/Modules/HomeModule.cs b/src/OnePeek.WebConsole/Modules/HomeModule.cs index 5e1e24d..e49a6e3 100644 --- a/src/OnePeek.WebConsole/Modules/HomeModule.cs +++ b/src/OnePeek.WebConsole/Modules/HomeModule.cs @@ -27,7 +27,7 @@ namespace OnePeek.WebConsole.Modules Get["/reviews", true] = async (ctx, token) => { - AppReviews reviews = await ratingEndpoint.GetReviews(Request.Query["id"], StoreType.WindowsPhone8, StoreCultureType.EN_US, StoreReviewSorting.Latest); + AppReviews reviews = await ratingEndpoint.GetReviews(Request.Query["id"], StoreType.WindowsPhone8, StoreCultureType.EN_US, StoreReviewSorting.Latest, Request.Query["prev"], Request.Query["next"]); return View["Reviews", reviews]; }; } diff --git a/src/OnePeek.WebConsole/Views/Meta.cshtml b/src/OnePeek.WebConsole/Views/Meta.cshtml index df51a90..4ffb284 100644 --- a/src/OnePeek.WebConsole/Views/Meta.cshtml +++ b/src/OnePeek.WebConsole/Views/Meta.cshtml @@ -3,6 +3,28 @@ Layout = "_Layout.cshtml"; } -@Model.Name + + @Model.Name + by @Model.Publisher.Name + + Rating: @Model.Rating.AverageRating (out of @Model.Rating.RatingCount) + + + + @Html.Raw(Model.Text.Replace("\n", "")) + + + + + - \ No newline at end of file + + + + Screenshots + + @foreach (var image in Model.Images.Screenshots) + { + + } + \ No newline at end of file diff --git a/src/OnePeek.WebConsole/Views/Reviews.cshtml b/src/OnePeek.WebConsole/Views/Reviews.cshtml index b3a30d1..0fdd71c 100644 --- a/src/OnePeek.WebConsole/Views/Reviews.cshtml +++ b/src/OnePeek.WebConsole/Views/Reviews.cshtml @@ -3,8 +3,14 @@ Layout = "_Layout.cshtml"; } +@if (!String.IsNullOrWhiteSpace(Model.PrevPageMarkerId)) +{ prev -next +} +@if (!String.IsNullOrWhiteSpace(Model.NextPageMarkerId)) +{ +next +} @foreach (var review in Model.Reviews) { diff --git a/src/OnePeek.WebConsole/Views/_Layout.cshtml b/src/OnePeek.WebConsole/Views/_Layout.cshtml index ca1d473..aaf1cd9 100644 --- a/src/OnePeek.WebConsole/Views/_Layout.cshtml +++ b/src/OnePeek.WebConsole/Views/_Layout.cshtml @@ -9,9 +9,7 @@ - - @RenderBody() - + @RenderBody()