Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmicPredator committed Sep 10, 2023
1 parent 1ffa6e8 commit 926a197
Show file tree
Hide file tree
Showing 19 changed files with 450 additions and 54 deletions.
4 changes: 2 additions & 2 deletions src/AniMoe.App/AniMoe.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<None Remove="Views\ReviewView.xaml" />
<None Remove="Views\RootWindow.xaml" />
<None Remove="Views\StaffView.xaml" />
<None Remove="Views\UserPage.xaml" />
<None Remove="Views\UserView.xaml" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -163,7 +163,7 @@
<None Update="Assets\profile.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Page Update="Views\UserPage.xaml">
<Page Update="Views\UserView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Views\StaffView.xaml">
Expand Down
2 changes: 1 addition & 1 deletion src/AniMoe.App/AniMoe.App.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<None Update="App.xaml">
<SubType>Designer</SubType>
</None>
<Page Update="Views\UserPage.xaml">
<Page Update="Views\UserView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\StaffView.xaml">
Expand Down
Binary file added src/AniMoe.App/AniMoe.App_TemporaryKey.pfx
Binary file not shown.
2 changes: 1 addition & 1 deletion src/AniMoe.App/Controls/MediaOverviewView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
<ItemsRepeater
x:Name="TagsItemRepeater"
VerticalAlignment="Top"
ItemTemplate="{StaticResource TagsItemTemplate}" />
ItemTemplate="{StaticResource TagsItemTemplate}"/>
</ScrollViewer>
</Grid>
<Button
Expand Down
3 changes: 3 additions & 0 deletions src/AniMoe.App/Models/MasterModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public partial class User

[JsonProperty("id")]
public int Id { get; set; }

[JsonProperty("unreadNotificationCount")]
public int UnreadNotificationCount { get; set; }
}

public partial class Avatar
Expand Down
199 changes: 199 additions & 0 deletions src/AniMoe.App/Models/UserModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
using AniMoe.App.Services;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AniMoe.App.Models.UserModel
{
public partial class UserModel
{
[JsonProperty("data")]
public Data Data { get; set; }
}

public partial class Data
{
[JsonProperty("User")]
public User User { get; set; }
}

public partial class User
{
[JsonProperty("id")]
public long Id { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("about")]
public string About { get; set; }

[JsonProperty("avatar")]
public Avatar Avatar { get; set; }

[JsonProperty("bannerImage")]
public Uri BannerImage { get; set; }

[JsonProperty("isFollowing")]
public bool IsFollowing { get; set; }

[JsonProperty("isFollower")]
public bool IsFollower { get; set; }

[JsonProperty("isBlocked")]
public bool IsBlocked { get; set; }

[JsonProperty("siteUrl")]
public Uri SiteUrl { get; set; }

[JsonProperty("donatorTier")]
public long DonatorTier { get; set; }

[JsonProperty("donatorBadge")]
public string DonatorBadge { get; set; }

[JsonProperty("moderatorRoles")]
public object ModeratorRoles { get; set; }

[JsonProperty("statistics")]
public Statistics Statistics { get; set; }
}

public partial class Avatar
{
[JsonProperty("large")]
public Uri Large { get; set; }
}

public partial class Statistics
{
[JsonProperty("anime")]
public Anime Anime { get; set; }

[JsonProperty("manga")]
public Anime Manga { get; set; }
}

public partial class Anime
{
[JsonProperty("count")]
public long Count { get; set; }

[JsonProperty("meanScore")]
public double MeanScore { get; set; }

[JsonProperty("standardDeviation")]
public double StandardDeviation { get; set; }

[JsonProperty("minutesWatched")]
public long MinutesWatched { get; set; }

[JsonProperty("episodesWatched")]
public long EpisodesWatched { get; set; }

[JsonProperty("chaptersRead")]
public long ChaptersRead { get; set; }

[JsonProperty("volumesRead")]
public long VolumesRead { get; set; }

[JsonProperty("scores")]
public Country[] Scores { get; set; }

[JsonProperty("lengths")]
public Country[] Lengths { get; set; }

[JsonProperty("genres")]
public Genre[] Genres { get; set; }

[JsonProperty("tags")]
public Genre[] Tags { get; set; }

[JsonProperty("formats")]
public Country[] Formats { get; set; }

[JsonProperty("countries")]
public Country[] Countries { get; set; }

[JsonProperty("releaseYears")]
public Country[] ReleaseYears { get; set; }

[JsonProperty("startYears")]
public Country[] StartYears { get; set; }
}

public partial class Country
{
[JsonProperty("count")]
public long Count { get; set; }

[JsonProperty("meanScore")]
public double MeanScore { get; set; }

[JsonProperty("minutesWatched")]
public long MinutesWatched { get; set; }

[JsonProperty("country")]
public string CountryCountry { get; set; }

[JsonProperty("format")]
public string Format { get; set; }

[JsonProperty("releaseYear")]
public long? ReleaseYear { get; set; }

[JsonProperty("startYear")]
public long? StartYear { get; set; }
}

public partial class Genre
{
[JsonProperty("genre")]
public string GenreGenre { get; set; }

[JsonProperty("count")]
public long Count { get; set; }

[JsonProperty("meanScore")]
public double MeanScore { get; set; }

[JsonProperty("minutesWatched")]
public long MinutesWatched { get; set; }

[JsonProperty("mediaIds")]
public long[] MediaIds { get; set; }

[JsonProperty("tag")]
public Tag Tag { get; set; }
}

public partial class Tag
{
[JsonProperty("id")]
public long Id { get; set; }

[JsonProperty("name")]
public string Name { get; set; }
}

public static partial class Initialize
{
public static async Task<UserModel> FetchData(int userId, bool isSelf)
{
IRequestHandler Handler = App.Current.Services.GetService<IRequestHandler>();
UserModel Model = await Handler.RequestApi<UserModel>(
Queries.Query.UserInfoQuery,
new
{
userId,
isSelf
}
);
return Model;
}
}
}
2 changes: 1 addition & 1 deletion src/AniMoe.App/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<Identity
Name="ef227002-f5fe-43f0-9e3f-a4e3671b2a35"
Publisher="CN=CosmicPredator"
Publisher="CN=baran"
Version="0.1.0.0" />

<Properties>
Expand Down
1 change: 1 addition & 0 deletions src/AniMoe.App/Queries/MasterQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static partial class Query
query {
Viewer {
name
unreadNotificationCount
avatar {
large
medium
Expand Down
132 changes: 132 additions & 0 deletions src/AniMoe.App/Queries/UserInfoQuery.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AniMoe.App.Queries
{
public static partial class Query
{
public static string UserInfoQuery = @"
query ($userId: Int, $isSelf: Boolean = false) {
User(id: $userId) {
id
name
about
avatar {
large
}
bannerImage
isFollowing @skip(if: $isSelf)
isFollower @skip(if: $isSelf)
isBlocked
siteUrl
donatorTier
donatorBadge
moderatorRoles
statistics {
anime {
...UserStats
}
manga {
...UserStats
}
}
}
}
fragment UserStats on UserStatistics {
count
meanScore
standardDeviation
minutesWatched
episodesWatched
chaptersRead
volumesRead
scores {
...ScoreStats
}
lengths {
...LengthStats
}
genres {
...GenreStats
}
tags {
...TagStats
}
formats {
...FormatStats
}
countries {
...CountryStats
}
releaseYears {
...ReleaseYearStats
}
startYears {
...WatchYearStats
}
}
fragment ScoreStats on UserScoreStatistic {
count
minutesWatched
meanScore
}
fragment LengthStats on UserLengthStatistic {
count
minutesWatched
meanScore
}
fragment GenreStats on UserGenreStatistic {
genre
count
meanScore
minutesWatched
mediaIds
}
fragment TagStats on UserTagStatistic {
count
meanScore
minutesWatched
mediaIds
tag {
id
name
}
}
fragment FormatStats on UserFormatStatistic {
count
meanScore
minutesWatched
format
}
fragment CountryStats on UserCountryStatistic {
count
meanScore
minutesWatched
country
}
fragment ReleaseYearStats on UserReleaseYearStatistic {
count
meanScore
minutesWatched
releaseYear
}
fragment WatchYearStats on UserStartYearStatistic {
count
meanScore
minutesWatched
startYear
}";
}
}
Loading

0 comments on commit 926a197

Please sign in to comment.