You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[cleanup] remove unused methods from OneSignalClient
Looks like these methods are no longer used within the SDK, so let's remove them from OneSignalClient:
- executeSimultaneousRequests
- executeSynchronousRequest
- executeDataRequest
Update OneSignalClient.h
And types:
- OSDataRequestSuccessBlock
- OSMultipleCompletionBlock
- OSMultipleFailureBlock
- OSMultipleSuccessBlock
- genericTimedOutError
TODO: We want to eventually migrate over to using this method for executing simultaneous requests:
53
-
This allows us to combine multiple async concurrent requests to return from a single callback with the proper formatted responses from each reuqest (successful or not, account for params returning from GETs).
54
-
A generalized format should be followed and we should make sure not to break form that as it could break peoples apps in the future if we add params and remove params from this callback.
55
-
Currently for the only implementation this is used for "setExternalUserId:withCOmpletion:" the format is as follows:
56
-
57
-
NSDictionary response = @{
58
-
(required) @"push" : {
59
-
@"success" : @(true) or @(false)
60
-
},
61
-
62
-
(optional) @"email" : {
63
-
@"success" : @(true) or @(false)
64
-
}
65
-
}
66
-
67
-
68
-
Building off of this format now will require:
69
-
70
-
1. Including other attributes and whether they are required or not
71
-
ex. @"push" is always going to be within the callback resposne (required), meanwhile,
72
-
@"email" will not always exist in the callback resposne (optoinal)
73
-
74
-
2. Can't remove params that are required as an app may be expecting them and removing/modifying a key could break there app with an SDK upgrade
return [NSErrorerrorWithDomain:@"OneSignal Error"code:0userInfo:@{@"error" : [NSStringstringWithFormat:@"Attempted to perform an HTTP request (%@) before the user provided privacy consent.", type]}];
failureBlock([NSErrorerrorWithDomain:@"onesignal"code:0userInfo:@{@"error" : [NSStringstringWithFormat:@"Attempted to execute a data-only API request (%@) using OneSignalClient's executeRequest: method, which only accepts JSON-based API requests", NSStringFromClass(request.class)]}]);
failureBlock([NSErrorerrorWithDomain:@"onesignal"code:0userInfo:@{@"error" : [NSStringstringWithFormat:@"Attempted to execute an API request (%@) using OneSignalClient's executeDataRequest: method, which only accepts data based requests", NSStringFromClass(request.class)]}]);
0 commit comments