Skip to content

Commit 79225e8

Browse files
committed
Update iOS to use live activity namespace
1 parent 7490654 commit 79225e8

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using OneSignalSDK.DotNet.Core;
3+
using OneSignalSDK.DotNet.Core.LiveActivities;
4+
using OneSignalSDK.DotNet.iOS.Utilities;
5+
using OneSignalNative = Com.OneSignal.iOS.OneSignal;
6+
namespace OneSignalSDK.DotNet.iOS
7+
{
8+
public class iOSLiveActivitiesManager: ILiveActivitiesManager
9+
{
10+
public async Task<bool> Enter(string activityId, string token)
11+
{
12+
BooleanCallbackProxy proxy = new BooleanCallbackProxy();
13+
OneSignalNative.LiveActivities.Enter(activityId, token, response => proxy.OnResponse(true), response => proxy.OnResponse(false));
14+
return await proxy;
15+
}
16+
17+
public async Task<bool> Exit(string activityId)
18+
{
19+
BooleanCallbackProxy proxy = new BooleanCallbackProxy();
20+
OneSignalNative.LiveActivities.Exit(activityId, response => proxy.OnResponse(true), response => proxy.OnResponse(false));
21+
return await proxy;
22+
}
23+
}
24+
}

OneSignalSDK.DotNet.iOS/iOSOneSignal.cs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
using OneSignalNative = Com.OneSignal.iOS.OneSignal;
1212
using OneSignalSDK.DotNet.iOS.Utilities;
13+
using OneSignalSDK.DotNet.Core.LiveActivities;
1314

1415
namespace OneSignalSDK.DotNet.iOS;
1516

@@ -27,6 +28,8 @@ public class iOSOneSignal : IOneSignal
2728

2829
public IDebugManager Debug { get; } = new iOSDebugManager();
2930

31+
public ILiveActivitiesManager LiveActivities { get; } = new iOSLiveActivitiesManager();
32+
3033
public bool ConsentRequired
3134
{
3235
set => OneSignalNative.SetConsentRequired(value);
@@ -70,18 +73,4 @@ public void Logout()
7073
{
7174
OneSignalNative.Logout();
7275
}
73-
74-
public async Task<bool> EnterLiveActivityAsync(string activityId, string token)
75-
{
76-
BooleanCallbackProxy proxy = new BooleanCallbackProxy();
77-
OneSignalNative.EnterLiveActivity(activityId, token, response => proxy.OnResponse(true), response => proxy.OnResponse(false));
78-
return await proxy;
79-
}
80-
81-
public async Task<bool> ExitLiveActivityAsync(string activityId)
82-
{
83-
BooleanCallbackProxy proxy = new BooleanCallbackProxy();
84-
OneSignalNative.ExitLiveActivity(activityId, response => proxy.OnResponse(true), response => proxy.OnResponse(false));
85-
return await proxy;
86-
}
8776
}

0 commit comments

Comments
 (0)