Rename RealmContextFactory to RealmAccess

This commit is contained in:
Dean Herbert
2022-01-24 19:59:58 +09:00
parent bb54ad9ad8
commit 6eb2c28e41
76 changed files with 516 additions and 516 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Online
private IDisposable? realmSubscription;
[Resolved]
private RealmContextFactory realmContextFactory { get; set; } = null!;
private RealmAccess realm { get; set; } = null!;
public BeatmapDownloadTracker(IBeatmapSetInfo trackedItem)
: base(trackedItem)
@ -42,7 +42,7 @@ namespace osu.Game.Online
// Used to interact with manager classes that don't support interface types. Will eventually be replaced.
var beatmapSetInfo = new BeatmapSetInfo { OnlineID = TrackedItem.OnlineID };
realmSubscription = realmContextFactory.RegisterForNotifications(realm => realm.All<BeatmapSetInfo>().Where(s => s.OnlineID == TrackedItem.OnlineID && !s.DeletePending), (items, changes, ___) =>
realmSubscription = realm.RegisterForNotifications(realm => realm.All<BeatmapSetInfo>().Where(s => s.OnlineID == TrackedItem.OnlineID && !s.DeletePending), (items, changes, ___) =>
{
if (items.Any())
Schedule(() => UpdateState(DownloadState.LocallyAvailable));

View File

@ -30,7 +30,7 @@ namespace osu.Game.Online.Rooms
protected override bool RequiresChildrenUpdate => true;
[Resolved]
private RealmContextFactory realmContextFactory { get; set; } = null!;
private RealmAccess realm { get; set; } = null!;
/// <summary>
/// The availability state of the currently selected playlist item.
@ -78,7 +78,7 @@ namespace osu.Game.Online.Rooms
// handles changes to hash that didn't occur from the import process (ie. a user editing the beatmap in the editor, somehow).
realmSubscription?.Dispose();
realmSubscription = realmContextFactory.RegisterForNotifications(realm => filteredBeatmaps(), (items, changes, ___) =>
realmSubscription = realm.RegisterForNotifications(realm => filteredBeatmaps(), (items, changes, ___) =>
{
if (changes == null)
return;
@ -128,9 +128,9 @@ namespace osu.Game.Online.Rooms
int onlineId = SelectedItem.Value.Beatmap.Value.OnlineID;
string checksum = SelectedItem.Value.Beatmap.Value.MD5Hash;
return realmContextFactory.Context
.All<BeatmapInfo>()
.Filter("OnlineID == $0 && MD5Hash == $1 && BeatmapSet.DeletePending == false", onlineId, checksum);
return realm.Realm
.All<BeatmapInfo>()
.Filter("OnlineID == $0 && MD5Hash == $1 && BeatmapSet.DeletePending == false", onlineId, checksum);
}
protected override void Dispose(bool isDisposing)

View File

@ -23,7 +23,7 @@ namespace osu.Game.Online
private IDisposable? realmSubscription;
[Resolved]
private RealmContextFactory realmContextFactory { get; set; } = null!;
private RealmAccess realm { get; set; } = null!;
public ScoreDownloadTracker(ScoreInfo trackedItem)
: base(trackedItem)
@ -47,7 +47,7 @@ namespace osu.Game.Online
Downloader.DownloadBegan += downloadBegan;
Downloader.DownloadFailed += downloadFailed;
realmSubscription = realmContextFactory.RegisterForNotifications(realm => realm.All<ScoreInfo>().Where(s => ((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID) || s.Hash == TrackedItem.Hash) && !s.DeletePending), (items, changes, ___) =>
realmSubscription = realm.RegisterForNotifications(realm => realm.All<ScoreInfo>().Where(s => ((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID) || s.Hash == TrackedItem.Hash) && !s.DeletePending), (items, changes, ___) =>
{
if (items.Any())
Schedule(() => UpdateState(DownloadState.LocallyAvailable));