File tree Expand file tree Collapse file tree 9 files changed +17
-35
lines changed
OneSignalExample/Assets/OneSignal/Example
com.onesignal.unity.android/Runtime
com.onesignal.unity.ios/Runtime Expand file tree Collapse file tree 9 files changed +17
-35
lines changed Original file line number Diff line number Diff line change @@ -306,10 +306,10 @@ public async void PromptForPush() {
306
306
_log ( $ "Notification permission is: { OneSignal . Default . Notifications . Permission } ") ;
307
307
}
308
308
309
- public async void ClearPush ( ) {
310
- _log ( "Clearing existing OneSignal push notifications and awaiting result ... " ) ;
309
+ public void ClearPush ( ) {
310
+ _log ( "Clearing existing OneSignal push notifications" ) ;
311
311
312
- await OneSignal . Default . Notifications . ClearAllNotificationsAsync ( ) ;
312
+ OneSignal . Default . Notifications . ClearAllNotifications ( ) ;
313
313
314
314
_log ( "Notifications cleared" ) ;
315
315
}
@@ -375,15 +375,10 @@ public void AddOutcomeWithValue() {
375
375
* Location
376
376
*/
377
377
378
- public async void PromptLocation ( ) {
379
- _log ( "Opening permission prompt for location and awaiting result... " ) ;
378
+ public void PromptLocation ( ) {
379
+ _log ( "Opening permission prompt for location" ) ;
380
380
381
- var result = await OneSignal . Default . Location . RequestPermissionAsync ( ) ;
382
-
383
- if ( result )
384
- _log ( "User opted in" ) ;
385
- else
386
- _log ( "User opted out" ) ;
381
+ OneSignal . Default . Location . RequestPermission ( ) ;
387
382
}
388
383
389
384
public void ToggleShareLocation ( ) {
Original file line number Diff line number Diff line change @@ -45,10 +45,9 @@ public bool IsShared {
45
45
set => _location . Call ( "setShared" , value ) ;
46
46
}
47
47
48
- public async Task < bool > RequestPermissionAsync ( ) {
48
+ public void RequestPermission ( ) {
49
49
var continuation = new BoolContinuation ( ) ;
50
50
_location . Call < AndroidJavaObject > ( "requestPermission" , continuation . Proxy ) ;
51
- return await continuation ;
52
51
}
53
52
}
54
53
}
Original file line number Diff line number Diff line change @@ -54,10 +54,9 @@ public async Task<bool> RequestPermissionAsync(bool fallbackToSettings) {
54
54
return await continuation ;
55
55
}
56
56
57
- public async Task ClearAllNotificationsAsync ( ) {
57
+ public void ClearAllNotifications ( ) {
58
58
var continuation = new Continuation ( ) ;
59
59
_notifications . Call < AndroidJavaObject > ( "clearAllNotifications" , continuation . Proxy ) ;
60
- await continuation ;
61
60
}
62
61
63
62
public void Initialize ( ) {
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ namespace OneSignalSDKNew.Location {
31
31
internal sealed class LocationManager : ILocationManager {
32
32
public bool IsShared { get ; set ; }
33
33
34
- public Task < bool > RequestPermissionAsync ( ) {
35
- return Task . FromResult ( false ) ;
34
+ public void RequestPermission ( ) {
35
+
36
36
}
37
37
}
38
38
}
Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ public Task<bool> RequestPermissionAsync(bool fallbackToSettings){
40
40
return Task . FromResult ( false ) ;
41
41
}
42
42
43
- public Task ClearAllNotificationsAsync ( ) {
44
- return Task . CompletedTask ;
43
+ public void ClearAllNotifications ( ) {
44
+
45
45
}
46
46
}
47
47
}
Original file line number Diff line number Diff line change @@ -41,14 +41,6 @@ public interface ILocationManager {
41
41
/// <summary>
42
42
/// Helper method to show the native prompt to ask the user for consent to share their location
43
43
/// </summary>
44
- /// <param name="fallbackToSettings">
45
- /// Whether to direct the user to this app's settings to drive enabling of notifications,
46
- /// when the in-app prompting is not possible.
47
- /// </param>
48
- /// <returns>
49
- /// Awaitable boolean of true if the user opted in to location permission or
50
- /// false if the user is opted out of location permission
51
- /// </returns>
52
- Task < bool > RequestPermissionAsync ( ) ;
44
+ void RequestPermission ( ) ;
53
45
}
54
46
}
Original file line number Diff line number Diff line change @@ -89,9 +89,8 @@ public interface INotificationsManager {
89
89
Task < bool > RequestPermissionAsync ( bool fallbackToSettings ) ;
90
90
91
91
/// <summary>
92
- /// Removes all OneSignal app notifications from the Notification Shade
92
+ /// Removes all OneSignal app notifications
93
93
/// </summary>
94
- /// <remarks>Android Only</remarks>
95
- Task ClearAllNotificationsAsync ( ) ;
94
+ void ClearAllNotifications ( ) ;
96
95
}
97
96
}
Original file line number Diff line number Diff line change @@ -41,9 +41,8 @@ public bool IsShared {
41
41
set => _locationSetIsShared ( value ) ;
42
42
}
43
43
44
- public Task < bool > RequestPermissionAsync ( ) { // iOS make async
44
+ public void RequestPermission ( ) { // iOS make async
45
45
_locationRequestPermission ( ) ;
46
- return Task . FromResult ( true ) ;
47
46
}
48
47
}
49
48
}
Original file line number Diff line number Diff line change @@ -71,9 +71,8 @@ public async Task<bool> RequestPermissionAsync(bool fallbackToSettings) {
71
71
return await proxy ;
72
72
}
73
73
74
- public Task ClearAllNotificationsAsync ( ) {
74
+ public void ClearAllNotifications ( ) {
75
75
_notificationsClearAll ( ) ;
76
- return Task . CompletedTask ;
77
76
}
78
77
79
78
public void Initialize ( ) {
You can’t perform that action at this time.
0 commit comments