Skip to content

Remote PR Set #3 #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gestrich
Copy link
Contributor

@gestrich gestrich commented Jun 12, 2023

This is part of a collection of foundational PRs that need to merge at the same time.

Loop
LoopKit
NightscoutService
TidepoolService

*/
func commandFromPushNotification(_ notification: [String: AnyObject]) async throws -> RemoteCommand
func handleRemoteNotification(_ notification: [String: AnyObject]) async throws

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REMOTE 2.0: WILL REMOVE PRE-MERGE

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "handle" is one of those non-descriptive verbs, like "process". Every function "handles" something or "processes" something. Maybe something like remoteNotificationWasReceived(_ notification ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

func handleRemoteOverride(name: String, durationTime: TimeInterval?, remoteAddress: String) async throws
func handleRemoteOverrideCancel() async throws
func handleRemoteCarb(amountInGrams: Double, absorptionTime: TimeInterval?, foodType: String?, startDate: Date?) async throws
func handleRemoteBolus(amountInUnits: Double) async throws
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REMOTE 2.0: WILL REMOVE PRE-MERGE

//

import Foundation

Copy link
Contributor Author

@gestrich gestrich Jun 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RemoteActionDelegate is conformed to both by the ServiceManager and DeviceDataManager to propogate actions to where they are delivered.

I'm using "handleRemote" in the method names to help disambiguate from existing APIs in DeviceDataManaager, like "enactBolus". I can drop the prefix if desired though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, "handle" is very vague. This API is exposing dosing functionality and settings change functionality. So it would be more descriptive to have the verbs describe actually enacting or delivering. I think it's fine to keep the "remote" in there, as that's the main foreseeable use for this API, but an API like this could theoretically be used by Services for other things, like maybe they have some kind of other trigger to change dosing, like a timer, or other notification.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done but let me know if feedback on the names below.

@gestrich gestrich force-pushed the feature/2023/06/bg/remote-command-service-refactor branch from a82acc8 to 98070db Compare June 17, 2023 15:52
throw MockServicePushNotificationError.remoteCommandsNotSupported
public func handleRemoteNotification(_ notification: [String: AnyObject]) async throws {
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REMOTE 2.0: WILL REMOVE PRE-MERGE

@gestrich gestrich marked this pull request as ready for review June 17, 2023 16:54
@gestrich gestrich force-pushed the feature/2023/06/bg/remote-command-service-refactor branch from 98070db to cb3f748 Compare June 19, 2023 09:33
Copy link
Collaborator

@ps2 ps2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ps2 ps2 merged commit 6670715 into LoopKit:dev Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants