// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; using System.Threading.Tasks; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Users; namespace osu.Game.Online.Metadata { public abstract partial class MetadataClient : Component, IMetadataClient, IMetadataServer { public abstract IBindable IsConnected { get; } #region Beatmap metadata updates public abstract Task GetChangesSince(int queueId); public abstract Task BeatmapSetsUpdated(BeatmapUpdates updates); public event Action? ChangedBeatmapSetsArrived; protected Task ProcessChanges(int[] beatmapSetIDs) { ChangedBeatmapSetsArrived?.Invoke(beatmapSetIDs.Distinct().ToArray()); return Task.CompletedTask; } #endregion #region User presence updates /// /// Whether the client is currently receiving user presence updates from the server. /// public abstract IBindable IsWatchingUserPresence { get; } /// /// Dictionary keyed by user ID containing all of the information about currently online users received from the server. /// public abstract IBindableDictionary UserStates { get; } /// public abstract Task UpdateActivity(UserActivity? activity); /// public abstract Task UpdateStatus(UserStatus? status); /// public abstract Task BeginWatchingUserPresence(); /// public abstract Task EndWatchingUserPresence(); /// public abstract Task UserPresenceUpdated(int userId, UserPresence? presence); #endregion #region Daily Challenge public abstract IBindable DailyChallengeInfo { get; } /// public abstract Task DailyChallengeUpdated(DailyChallengeInfo? info); #endregion #region Disconnection handling public event Action? Disconnecting; public virtual Task DisconnectRequested() { Schedule(() => Disconnecting?.Invoke()); return Task.CompletedTask; } #endregion } }