Skip to content

Commit 744f173

Browse files
committed
Fix method names
1 parent 739de26 commit 744f173

File tree

10 files changed

+46
-28
lines changed

10 files changed

+46
-28
lines changed

OneSignalExample/Assets/OneSignal/Example/OneSignalExampleBehaviour.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public async void LoginOneSignalUser() {
228228

229229
public void LogoutOneSignalUser() {
230230
_log($"Logging out user ");
231-
OneSignal.Default.Logout();
231+
OneSignal.Default.LogoutAsync();
232232
}
233233

234234
public void AddEmail() {
@@ -258,12 +258,12 @@ public void RemoveSms() {
258258
public async void PromptForPush() {
259259
_log("Opening permission prompt for push notifications and awaiting result...");
260260

261-
var result = await OneSignal.Default.Notifications.RequestPermisionAsync(true);
261+
var result = await OneSignal.Default.Notifications.RequestPermissionAsync(true);
262262

263263
if (result)
264264
_log("User opted in");
265265
else
266-
_error("User opted out");
266+
_log("User opted out");
267267
}
268268

269269
public void ClearPush() {
@@ -335,17 +335,17 @@ public void AddOutcomeWithValue() {
335335
public async void PromptLocation() {
336336
_log("Opening permission prompt for location and awaiting result...");
337337

338-
var result = await OneSignal.Default.Location.RequestPermisionAsync(true);
338+
var result = await OneSignal.Default.Location.RequestPermissionAsync(true);
339339

340340
if (result)
341341
_log("User opted in");
342342
else
343-
_error("User opted out");
343+
_log("User opted out");
344344
}
345345

346346
public void ToggleShareLocation() {
347-
_log($"Toggling ShareLocation to <b>{!OneSignal.Default.Location.IsLocationShared}</b>");
348-
OneSignal.Default.Location.IsLocationShared = !OneSignal.Default.Location.IsLocationShared;
347+
_log($"Toggling ShareLocation to <b>{!OneSignal.Default.Location.IsShared}</b>");
348+
OneSignal.Default.Location.IsShared = !OneSignal.Default.Location.IsShared;
349349
}
350350

351351
/*

com.onesignal.unity.core/Editor/Platform/LocationManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
namespace OneSignalSDKNew.Location {
3131
internal sealed class LocationManager : ILocationManager {
32-
public bool IsLocationShared { get; set; }
32+
public bool IsShared { get; set; }
3333

34-
public Task<bool> RequestPermisionAsync(bool fallbackToSettings) {
34+
public Task<bool> RequestPermissionAsync(bool fallbackToSettings) {
3535
return Task.FromResult(false);
3636
}
3737
}

com.onesignal.unity.core/Editor/Platform/NotificationsManager.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ internal sealed class NotificationsManager : INotificationsManager {
3636

3737
public bool Permission { get; }
3838

39-
public bool PushEnabled { get; set; }
40-
41-
public Task<bool> RequestPermisionAsync(bool fallbackToSettings){
39+
public Task<bool> RequestPermissionAsync(bool fallbackToSettings){
4240
return Task.FromResult(false);
4341
}
4442

com.onesignal.unity.core/Editor/Platform/OneSignalNative.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public override Task LoginAsync(string externalId, string jwtBearerToken = null)
9292
return Task.FromResult(false);
9393
}
9494

95-
public override void Logout() {
95+
public override void LogoutAsync() {
9696

9797
}
9898
}

com.onesignal.unity.core/Editor/Platform/PushSubscription.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ internal sealed class PushSubscription : IPushSubscription {
3434

3535
public string Token { get; }
3636

37-
public bool Enabled { get; set; }
37+
public bool OptedIn { get; set; }
38+
39+
public void OptIn() {
40+
41+
}
42+
43+
public void OptOut() {
44+
45+
}
3846
}
3947
}

com.onesignal.unity.core/Runtime/Behaviors/OneSignalBehaviour.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ public class OneSignalBehaviour : MonoBehaviour {
6060
/// Disable or enable location collection by OneSignal (defaults to enabled if your app has location permission).
6161
/// </summary>
6262
/// <remarks>This method must be called before <see cref="OneSignal.Initialize"/> on iOS.</remarks>
63-
public bool IsLocationShared = false;
63+
public bool IsShared = false;
6464

6565
private void Start() {
6666
OneSignal.Default.Debug.LogLevel = LogLevel;
6767
OneSignal.Default.Debug.AlertLevel = AlertLevel;
6868
OneSignal.Default.RequiresPrivacyConsent = RequiresPrivacyConsent;
69-
OneSignal.Default.Location.IsLocationShared = IsLocationShared;
69+
OneSignal.Default.Location.IsShared = IsShared;
7070

7171
OneSignal.Default.Initialize(AppId);
7272
}

com.onesignal.unity.core/Runtime/Location/ILocationManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface ILocationManager {
3636
/// Disable or enable location collection by OneSignal (defaults to enabled if your app has location permission).
3737
/// </summary>
3838
/// <remarks>This method must be called before <see cref="OneSignal.Initialize"/> on iOS.</remarks>
39-
bool IsLocationShared { get; set; }
39+
bool IsShared { get; set; }
4040

4141
/// <summary>
4242
/// Helper method to show the native prompt to ask the user for consent to share their location
@@ -49,6 +49,6 @@ public interface ILocationManager {
4949
/// Awaitable boolean of true if the user opted in to location permission or
5050
/// false if the user is opted out of location permission
5151
/// </returns>
52-
Task<bool> RequestPermisionAsync(bool fallbackToSettings);
52+
Task<bool> RequestPermissionAsync(bool fallbackToSettings);
5353
}
5454
}

com.onesignal.unity.core/Runtime/Notifications/INotificationsManager.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ public interface INotificationsManager {
7070
/// </summary>
7171
event PermissionChangedDelegate PermissionChanged;
7272

73-
/// <summary>
74-
/// Whether push notifications are currently enabled for an active push subscription.
75-
/// </summary>
76-
/// <remarks>Can be used to turn off push notifications for a user without removing their user data</remarks>
77-
bool PushEnabled { get; set; }
78-
7973
/// <summary>
8074
/// Current status of permissions granted by this device for push notifications
8175
/// </summary>
@@ -92,7 +86,7 @@ public interface INotificationsManager {
9286
/// Awaitable boolean of true if the user opted in to push notifications or
9387
/// false if the user opted out of push notifications.
9488
/// </returns>
95-
Task<bool> RequestPermisionAsync(bool fallbackToSettings);
89+
Task<bool> RequestPermissionAsync(bool fallbackToSettings);
9690

9791
/// <summary>
9892
/// Removes all OneSignal app notifications from the Notification Shade

com.onesignal.unity.core/Runtime/OneSignal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,6 @@ internal set {
147147
/// be retrieved, except through this device as long as the app remains installed and the app
148148
/// data is not cleared.
149149
/// </summary>
150-
public abstract void Logout();
150+
public abstract void LogoutAsync();
151151
}
152152
}

com.onesignal.unity.core/Runtime/User/Models/IPushSubscription.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,26 @@ public interface IPushSubscription { // TODO: class or interface ? AndroidPushSu
5757
string Token { get; }
5858

5959
/// <summary>
60-
/// Whether this subscription is currently active
60+
/// Whether the user of this subscription is opted-in to received notifications. When true,
61+
/// the user is able to receive notifications through this subscription. Otherwise, the
62+
/// user will not receive notifications through this subscription (even when the user has
63+
/// granted app permission).
6164
/// </summary>
62-
bool Enabled { get; set; }
65+
bool OptedIn { get; set; }
66+
67+
/// <summary>
68+
/// Opt the user into this push subscription. If the application does not have permission,
69+
/// the user will be prompted by Android to permit push permissions. If the user has
70+
/// granted app permission, the user will be able to receive push notification. If the user
71+
/// rejects app permission, the user will only be able to receive push notifications once
72+
/// the app permission has been granted.
73+
/// </summary>
74+
void OptIn();
75+
76+
/// <summary>
77+
/// Opt the user out of this push subscription. The user will no longer received push
78+
/// notifications, although the app permission state will not be changed.
79+
/// </summary>
80+
void OptOut();
6381
}
6482
}

0 commit comments

Comments
 (0)