-
Notifications
You must be signed in to change notification settings - Fork 548
Open
Labels
copilot-candidateenhancementThe issue or pull request is an enhancementThe issue or pull request is an enhancementgood first issueThis is a good first issue for someone to start working with our codeThis is a good first issue for someone to start working with our codehelp wantedThis is an issue or pull request where we request help from the community to fix or completeThis is an issue or pull request where we request help from the community to fix or complete
Milestone
Description
See customer struggle here:
https://discord.com/channels/732297728826277939/732297808148824115/1120406222974234685
They were doing this:
var sensors = new NSString[] {
new NSString(SRSensor.MessagesUsageReport.ToString()),
new NSString(SRSensor.PhoneUsageReport.ToString()),
new NSString(SRSensor.DeviceUsageReport.ToString())
};
var nsset = new NSSet<NSString>(sensors);
await SRSensorReader.RequestAuthorizationAsync(nsset);when the correct is this:
var sensors = new NSString[] {
new NSString(SRSensor.MessagesUsageReport.GetConstant()),
new NSString(SRSensor.PhoneUsageReport.GetConstant()),
new NSString(SRSensor.DeviceUsageReport.GetConstant())
};
var nsset = new NSSet<NSString>(sensors);
await SRSensorReader.RequestAuthorizationAsync(nsset);However, we should be able to improve the API to something like this:
var sensors = new [] {
SRSensor.MessagesUsageReport,
SRSensor.PhoneUsageReport,
SRSensor.DeviceUsageReport,
};
await SRSensorReader.RequestAuthorization (sensors);and then we just do the right thing in this overload, making it impossible for customers to make this kind of mistake again.
Just to clarify, we should add a manual overload taking an array of SRSensor values:
void RequestAuthorization (SRSensor[] sensors, Action<NSError> completion);Even better if there was a way to make the async overload take a params array:
Task RequestAuthorizationAsync (params SRSensor[] sensors);and then the calling code becomes:
await SRSensorReader.RequestAuthorization (
SRSensor.MessagesUsageReport,
SRSensor.PhoneUsageReport,
SRSensor.DeviceUsageReport);snechaev
Metadata
Metadata
Assignees
Labels
copilot-candidateenhancementThe issue or pull request is an enhancementThe issue or pull request is an enhancementgood first issueThis is a good first issue for someone to start working with our codeThis is a good first issue for someone to start working with our codehelp wantedThis is an issue or pull request where we request help from the community to fix or completeThis is an issue or pull request where we request help from the community to fix or complete