TweaksConfigurationsCoordinator registerForConfigurationsUpdates(...) info
Closed this issue · 3 comments
federicocappelli commented
Would be very useful to know which tweak has been changed when the closure registered with registerForConfigurationsUpdates(...)
is called.
Right now the information is present but is discarded one step before calling the closure:
public func registerForConfigurationsUpdates(_ object: NSObject, closure: @escaping () -> Void) {
deregisterFromConfigurationsUpdates(object)
let queue = OperationQueue.main
let name = TweaksConfigurationDidChangeNotification
let notificationsCenter = NotificationCenter.default
let observer = notificationsCenter.addObserver(forName: name, object: nil, queue: queue) { (_) in <---------------- discarded
closure()
}
observersMap[object] = observer
}
Something like this would propagate correctly the information.
let observer = notificationsCenter.addObserver(forName: name, object: nil, queue: queue) { (_ notification) in
closure(notification.userInfo)
}
albertodebortoli commented
👋 @federicocappelli I've created a ticket in our backlog to add this functionality but external PRs are always welcome 😄
federicocappelli commented
PR created #29
albertodebortoli commented
PR merged! 🙏