Replies: 1 comment 1 reply
-
Hi @sbwilson, it's hard to give concrete advice without seeing more code, but it does seem like something you would want to use here is the fact that For example, your // If using publisher
return .publisher {
endpoint.connect()
.map(Action.response)
}
// If using async sequence
return .run { send in
for await data in endpoint.response() {
await send(.response(data))
}
} That's the basic idea. One thing that definitely gives me pause about your code is the fact that your |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Just a curious little question on how to send an action into a reducer from inside a delegate method...
I'm working on a macOS application that needs to communicate with my own remote REST endpoints protected by OAuth2, currently using AlamoFire, OAuthSwift and the OAuth2SwiftAlamofire bridge, wrapped inside an
Endpoint
class. As part of the authentication flow, OAuth2Swift provides the ability to provide a delegate class (implementingOAuthSwiftURLHandlerType
) that provides a method for specifying how to display this login page. The default is to show it in the user's default web browser, but I'd like to have this appear inside a sheet or an embedded WebView (since the application is a full-screen kiosk-like application, and ignoring the fact that this is probably not a great idea security-wise, since in my case it's an internal application for an internal service containing non-sensitive data, so less chance of harm from this bad practice).My current reducer body looks similar to:
and for the URL handler:
What would be the recommended way to have my URL handler pass the URL back into this reducer? Or more generally, how does one handle the desire to send data from inside a delegate back to a reducer part-way through an
Effect.run
call? Or is this just a big design stink and I should redesign this?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions