Comments (5)
Here's my code for reference :
let shortLinkMiddleware = EffectMiddleware<DynamicLinkAction, DynamicLinkAction, AppState, DynamicLinkComponents>.onAction { action, context, getState in
let logger = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "ShortLinkMiddleware")
switch action {
case .generate:
return .promise(
token: "Any Hashable. Use this to cancel tasks, or to avoid two tasks of the same type",
perform: { context, completionblock in
os_log(
"Creating new short link...",
log: logger,
type: .debug
)
let state = getState()
let api = context.dependencies
if let link = URL(string: state.invitationDeepLink),
let bundleid = state.bundleID {
api.link = link
api.domain = state.universalLinkBaseURL
api.options = DynamicLinkComponentsOptions()
api.options?.pathLength = .unguessable
api.iOSParameters = DynamicLinkIOSParameters(bundleID: bundleid)
if let longDynamicLink = api.url {
DynamicLinkComponents.shortenURL(
longDynamicLink,
options: api.options,
completion: { url, warnings, error in
if let url = url {
completionblock(.response(url.absoluteString))
} else {
os_log(
"Error shortening the URL from : %s",
log: logger,
type: .debug,
String(describing: api.url)
)
completionblock(.error("Got an error while coverting short url"))
}
}
)
} else {
completionblock(.error("Hmmm... No long URL available."))
}
} else {
os_log(
"Error converting the deep link or bundleid...",
log: logger,
type: .debug
)
completionblock(.error("Got an error while converting short url"))
}
}
)
default: return .doNothing
}
}
from swiftrex.
You are right. I didn't look yet with more time but it seems that https://github.com/SwiftRex/SwiftRex/blob/develop/Sources/CombineRex/Effect/Effect.swift#L191 is missing a @escaping
clause before (OutputAction) -> Void
argument of outer closure. Can you test it please and open PR if it solves? Then I can release tonight if PR is open.
CombineRex, RxSwiftRex and ReactiveSwiftRex, I couldn't find a way to write one single Effect to rule them all (yet), so there's a bit of duplication unfortunately.
from swiftrex.
Also here https://github.com/SwiftRex/SwiftRex/blob/develop/Sources/CombineRex/Effect/Effect.swift#L210
from swiftrex.
Seems to fix the compilation issue. Testing it out right now.
from swiftrex.
Ok, v0.8.1 Release created, pushing Pods right now.
PS: I had to merge develop into master because of some release script fixes.
from swiftrex.
Related Issues (20)
- middleware lift with WritableKeyPath doesn't work on AnyMiddleware HOT 2
- Fix animations from Middleware
- Dead-Letter Queue HOT 1
- Memory leak in LiftMiddleware
- When will develop be the official release? HOT 2
- Lift EffectMiddleware using KeyPath not receiving context
- How to modify AppLifecycleMiddleware to adopt the new MiddlewareProtocol? HOT 2
- Redundant conformance of 'ASAPScheduler' to protocol 'Scheduler'
- Using await/async in middleware HOT 4
- IO monad and stack limit HOT 6
- I think it's time to enable Enabling Concurrency warnings in Xcode HOT 2
- Dynamic store HOT 5
- Migrate away from Travis CI HOT 4
- Design question : Model to State migration HOT 2
- Dispatch actions and run reducers on background thread? HOT 4
- CombineRex : Unexpected PublisherType behavior HOT 3
- Question about assertionFailure() HOT 5
- How organize communication between different states HOT 2
- Improve Tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftrex.