mirror of
https://github.com/osukey/osukey.git
synced 2025-06-22 19:57:56 +09:00
Merge branch 'master' into spotlights_api
This commit is contained in:
commit
4ef30f6a05
@ -54,6 +54,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.109.1" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.111.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -75,6 +75,9 @@ namespace osu.Desktop
|
|||||||
|
|
||||||
private void updateStatus()
|
private void updateStatus()
|
||||||
{
|
{
|
||||||
|
if (!client.IsInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if (status.Value is UserStatusOffline)
|
if (status.Value is UserStatusOffline)
|
||||||
{
|
{
|
||||||
client.ClearPresence();
|
client.ClearPresence();
|
||||||
|
@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
{
|
{
|
||||||
public class ColumnHitObjectArea : CompositeDrawable, IHasAccentColour
|
public class ColumnHitObjectArea : CompositeDrawable, IHasAccentColour
|
||||||
{
|
{
|
||||||
private const float hit_target_bar_height = 2;
|
|
||||||
|
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
private readonly Drawable hitTarget;
|
private readonly Drawable hitTarget;
|
||||||
@ -67,6 +65,8 @@ namespace osu.Game.Rulesets.Mania.UI.Components
|
|||||||
|
|
||||||
private class DefaultHitTarget : CompositeDrawable, IHasAccentColour
|
private class DefaultHitTarget : CompositeDrawable, IHasAccentColour
|
||||||
{
|
{
|
||||||
|
private const float hit_target_bar_height = 2;
|
||||||
|
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
private readonly Container hitTargetLine;
|
private readonly Container hitTargetLine;
|
||||||
|
30
osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs
Normal file
30
osu.Game/Online/API/Requests/MarkChannelAsReadRequest.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Net.Http;
|
||||||
|
using osu.Framework.IO.Network;
|
||||||
|
using osu.Game.Online.Chat;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.API.Requests
|
||||||
|
{
|
||||||
|
public class MarkChannelAsReadRequest : APIRequest
|
||||||
|
{
|
||||||
|
private readonly Channel channel;
|
||||||
|
private readonly Message message;
|
||||||
|
|
||||||
|
public MarkChannelAsReadRequest(Channel channel, Message message)
|
||||||
|
{
|
||||||
|
this.channel = channel;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string Target => $"chat/channels/{channel.Id}/mark-as-read/{message.Id}";
|
||||||
|
|
||||||
|
protected override WebRequest CreateWebRequest()
|
||||||
|
{
|
||||||
|
var req = base.CreateWebRequest();
|
||||||
|
req.Method = HttpMethod.Put;
|
||||||
|
return req;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -36,6 +36,11 @@ namespace osu.Game.Online.Chat
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly SortedList<Message> Messages = new SortedList<Message>(Comparer<Message>.Default);
|
public readonly SortedList<Message> Messages = new SortedList<Message>(Comparer<Message>.Default);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains all the messages that weren't read by the user.
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<Message> UnreadMessages => Messages.Where(m => LastReadId < m.Id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains all the messages that are still pending for submission to the server.
|
/// Contains all the messages that are still pending for submission to the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -75,6 +80,9 @@ namespace osu.Game.Online.Chat
|
|||||||
[JsonProperty(@"last_message_id")]
|
[JsonProperty(@"last_message_id")]
|
||||||
public long? LastMessageId;
|
public long? LastMessageId;
|
||||||
|
|
||||||
|
[JsonProperty(@"last_read_id")]
|
||||||
|
public long? LastReadId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Signalles if the current user joined this channel or not. Defaults to false.
|
/// Signalles if the current user joined this channel or not. Defaults to false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -445,6 +445,28 @@ namespace osu.Game.Online.Chat
|
|||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Marks the <paramref name="channel"/> as read
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="channel">The channel that will be marked as read</param>
|
||||||
|
public void MarkChannelAsRead(Channel channel)
|
||||||
|
{
|
||||||
|
if (channel.LastMessageId == channel.LastReadId)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var message = channel.Messages.LastOrDefault();
|
||||||
|
|
||||||
|
if (message == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var req = new MarkChannelAsReadRequest(channel, message);
|
||||||
|
|
||||||
|
req.Success += () => channel.LastReadId = message.Id;
|
||||||
|
req.Failure += e => Logger.Error(e, $"Failed to mark channel {channel} up to '{message}' as read");
|
||||||
|
|
||||||
|
api.Queue(req);
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
|
@ -279,6 +279,10 @@ namespace osu.Game.Overlays
|
|||||||
currentChannelContainer.Clear(false);
|
currentChannelContainer.Clear(false);
|
||||||
currentChannelContainer.Add(loaded);
|
currentChannelContainer.Add(loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mark channel as read when channel switched
|
||||||
|
if (e.NewValue.Messages.Any())
|
||||||
|
channelManager.MarkChannelAsRead(e.NewValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float startDragChatHeight;
|
private float startDragChatHeight;
|
||||||
|
@ -323,8 +323,6 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
Colour = Color4.Black.Opacity(0.25f),
|
Colour = Color4.Black.Opacity(0.25f),
|
||||||
Radius = 4,
|
Radius = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
ItemsContainer.Padding = new MarginPadding();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -163,10 +163,6 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
public string TooltipText => "Revert to default";
|
public string TooltipText => "Revert to default";
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
|
||||||
|
|
||||||
protected override bool OnMouseUp(MouseUpEvent e) => true;
|
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (bindable != null && !bindable.Disabled)
|
if (bindable != null && !bindable.Disabled)
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.109.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.111.0" />
|
||||||
<PackageReference Include="Sentry" Version="1.2.0" />
|
<PackageReference Include="Sentry" Version="1.2.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1230.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.109.1" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.111.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||||
<ItemGroup Label="Transitive Dependencies">
|
<ItemGroup Label="Transitive Dependencies">
|
||||||
@ -82,7 +82,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.109.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.111.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user