aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/Sdk/Friends/Detail/Ipc/ServiceCreator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Horizon/Sdk/Friends/Detail/Ipc/ServiceCreator.cs')
-rw-r--r--src/Ryujinx.Horizon/Sdk/Friends/Detail/Ipc/ServiceCreator.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/Ryujinx.Horizon/Sdk/Friends/Detail/Ipc/ServiceCreator.cs b/src/Ryujinx.Horizon/Sdk/Friends/Detail/Ipc/ServiceCreator.cs
new file mode 100644
index 00000000..1be804df
--- /dev/null
+++ b/src/Ryujinx.Horizon/Sdk/Friends/Detail/Ipc/ServiceCreator.cs
@@ -0,0 +1,51 @@
+using Ryujinx.Horizon.Common;
+using Ryujinx.Horizon.Sdk.Account;
+using Ryujinx.Horizon.Sdk.Sf;
+
+namespace Ryujinx.Horizon.Sdk.Friends.Detail.Ipc
+{
+ partial class ServiceCreator : IServiceCreator
+ {
+ private readonly IEmulatorAccountManager _accountManager;
+ private readonly NotificationEventHandler _notificationEventHandler;
+ private readonly FriendsServicePermissionLevel _permissionLevel;
+
+ public ServiceCreator(IEmulatorAccountManager accountManager, NotificationEventHandler notificationEventHandler, FriendsServicePermissionLevel permissionLevel)
+ {
+ _accountManager = accountManager;
+ _notificationEventHandler = notificationEventHandler;
+ _permissionLevel = permissionLevel;
+ }
+
+ [CmifCommand(0)]
+ public Result CreateFriendService(out IFriendService friendService)
+ {
+ friendService = new FriendService(_accountManager, _permissionLevel);
+
+ return Result.Success;
+ }
+
+ [CmifCommand(1)] // 2.0.0+
+ public Result CreateNotificationService(out INotificationService notificationService, Uid userId)
+ {
+ if (userId.IsNull)
+ {
+ notificationService = null;
+
+ return FriendResult.InvalidArgument;
+ }
+
+ notificationService = new NotificationService(_notificationEventHandler, userId, _permissionLevel);
+
+ return Result.Success;
+ }
+
+ [CmifCommand(2)] // 4.0.0+
+ public Result CreateDaemonSuspendSessionService(out IDaemonSuspendSessionService daemonSuspendSessionService)
+ {
+ daemonSuspendSessionService = new DaemonSuspendSessionService();
+
+ return Result.Success;
+ }
+ }
+}