Skip to content

Commit

Permalink
Merge branch 'release/v1.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tor4kichi committed Aug 5, 2024
2 parents 81be548 + 740e427 commit 914451c
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 366 deletions.
1 change: 1 addition & 0 deletions Hohoema.Core/Helpers/ShareHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public static void Share(string title, string content)
_ShareText = content;
_ShareTitleText = title;
DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView();
dataTransferManager.DataRequested -= DataTransferManager_DataRequested;
dataTransferManager.DataRequested += DataTransferManager_DataRequested;

DataTransferManager.ShowShareUI();
Expand Down
3 changes: 1 addition & 2 deletions Hohoema.Core/Hohoema.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@
<Compile Include="Models\Player\Video\NicoVideoSessionProvider.cs" />
<Compile Include="Models\Player\Video\NicoVideoTag.cs" />
<Compile Include="Models\Player\Video\VideoStreamingSession\CachedVideoStreamingSession.cs" />
<Compile Include="Models\Player\Video\VideoStreamingSession\DmcVideoStreamingSession.cs" />
<Compile Include="Models\Player\Video\VideoStreamingSession\IVideoStreamingSession.cs" />
<Compile Include="Models\Player\Video\VideoStreamingSession\VideoStreamingSession.cs" />
<Compile Include="Models\Playlist\HohoemaPlaylistPlayer.cs" />
Expand Down Expand Up @@ -378,7 +377,7 @@
<Version>2.7.2</Version>
</PackageReference>
<PackageReference Include="NiconicoToolkit">
<Version>0.5.5</Version>
<Version>0.6.2</Version>
</PackageReference>
<PackageReference Include="ReactiveProperty">
<Version>7.12.0</Version>
Expand Down
16 changes: 8 additions & 8 deletions Hohoema.Core/Models/Niconico/Video/NicoVideoProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,32 +329,32 @@ public async ValueTask<NicoVideoOwner> ResolveVideoOwnerAsync(VideoId videoId, C
}));
}

public async Task<WatchPageResponse> GetWatchPageResponseAsync(VideoId videoId, bool noHisotry = false)
public async Task<NicoVideoWatchApiResponse> GetWatchPageResponseAsync(VideoId videoId, bool noHisotry = false)
{
if (_niconicoSession.ServiceStatus.IsOutOfService())
{
return null;
}

WatchPageResponse data = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetInitialWatchDataAsync(videoId, !noHisotry, !noHisotry);
if (data.WatchApiResponse?.WatchApiData is not null and var watchData)
var data = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetWatchDataAsync(videoId);
if (data.Data.Response is not null and var watchData)
{
_ = UpdateCache(videoId, info =>
{
WatchApiVideo video = watchData.Video;
var video = watchData.Video;
info.VideoAliasId = videoId;
info.Title = video.Title;
info.Length = TimeSpan.FromSeconds(video.Duration);
info.PostedAt = video.RegisteredAt.DateTime;
info.ThumbnailUrl = video.Thumbnail.Url.OriginalString;
info.PostedAt = video.RegisteredAt;
info.ThumbnailUrl = video.Thumbnail.Url;
info.Description = video.Description;

if (watchData.Owner is not null and var userOwner)
{
info.Owner = new NicoVideoOwner()
{
ScreenName = userOwner.Nickname,
IconUrl = userOwner.IconUrl.OriginalString,
IconUrl = userOwner.IconUrl,
OwnerId = userOwner.Id.ToString(),
UserType = OwnerType.User
};
Expand All @@ -370,7 +370,7 @@ public async Task<WatchPageResponse> GetWatchPageResponseAsync(VideoId videoId,
};
}

return (watchData.Video.IsDeleted, default);
return (watchData.Video.IsDeleted.Value, default);
});
}

Expand Down
10 changes: 5 additions & 5 deletions Hohoema.Core/Models/Player/Video/Comment/CommentClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CommentClient(NiconicoSession niconicoSession, string rawVideoid)
public string RawVideoId { get; }
public string VideoOwnerId => _watchApiData!.Owner.Id.ToString();

internal DmcWatchApiData? _watchApiData { get; set; }
internal NicoVideoWatchApiResponse.Response? _watchApiData { get; set; }


private readonly NiconicoSession _niconicoSession;
Expand All @@ -48,7 +48,7 @@ public async Task<CommentPostResult> SubmitComment(string comment, TimeSpan posi
Guard.IsNotNull(_watchApiData);

VideoId videoId = _watchApiData.Video.Id;
NiconicoToolkit.Video.Watch.Thread mainThread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main);
NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Thread mainThread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main);
string threadId = mainThread.Id.ToString();

bool isPostCompleted = false;
Expand Down Expand Up @@ -86,7 +86,7 @@ public bool IsAllowAnnonimityComment
{
if (_watchApiData == null) { return false; }

return _watchApiData.Channel == null && _watchApiData.Community == null;
return _watchApiData.Channel == null;
}
}

Expand Down Expand Up @@ -154,7 +154,7 @@ private async Task<string> GetPostKeyLatestAsync(string threadForkLabel, Cancell
if (threadForkLabel == ThreadTargetForkConstants.Main)
{
Guard.IsNotNull(_watchApiData);
NiconicoToolkit.Video.Watch.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main);
NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main);
ThreadPostKeyResponse res = await _nvCommentApi.GetPostKeyAsync(thread.Id.ToString(), ct);
Guard.IsTrue(res.IsSuccess);

Expand All @@ -163,7 +163,7 @@ private async Task<string> GetPostKeyLatestAsync(string threadForkLabel, Cancell
else if (threadForkLabel == ThreadTargetForkConstants.Easy)
{
Guard.IsNotNull(_watchApiData);
NiconicoToolkit.Video.Watch.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Easy);
NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Easy);
ThreadEasyPostKeyResponse res = await _nvCommentApi.GetEasyPostKeyAsync(thread.Id.ToString(), ct);
Guard.IsTrue(res.IsSuccess);

Expand Down
Loading

0 comments on commit 914451c

Please sign in to comment.