Use constant foe UserInfo-key instead of string (IOS-192)
This commit is contained in:
parent
7f2d459ccb
commit
0e46a811b7
|
@ -27,7 +27,7 @@ extension DataSourceFacade {
|
||||||
)
|
)
|
||||||
|
|
||||||
let userInfo = [
|
let userInfo = [
|
||||||
"relationship": response.value,
|
.relationship: response.value,
|
||||||
]
|
]
|
||||||
|
|
||||||
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
||||||
|
|
|
@ -27,7 +27,7 @@ extension DataSourceFacade {
|
||||||
dependency.context.authenticationService.fetchFollowingAndBlockedAsync()
|
dependency.context.authenticationService.fetchFollowingAndBlockedAsync()
|
||||||
|
|
||||||
NotificationCenter.default.post(name: .relationshipChanged, object: nil, userInfo: [
|
NotificationCenter.default.post(name: .relationshipChanged, object: nil, userInfo: [
|
||||||
"relationship": response
|
.relationship: response
|
||||||
])
|
])
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
@ -75,7 +75,7 @@ extension DataSourceFacade {
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationCenter.default.post(name: .relationshipChanged, object: nil, userInfo: [
|
NotificationCenter.default.post(name: .relationshipChanged, object: nil, userInfo: [
|
||||||
"relationship": newRelationship
|
.relationship: newRelationship
|
||||||
])
|
])
|
||||||
|
|
||||||
await notificationView.configure(notification: notification, authenticationBox: dependency.authContext.mastodonAuthenticationBox)
|
await notificationView.configure(notification: notification, authenticationBox: dependency.authContext.mastodonAuthenticationBox)
|
||||||
|
@ -115,7 +115,7 @@ extension DataSourceFacade {
|
||||||
)
|
)
|
||||||
|
|
||||||
let userInfo = [
|
let userInfo = [
|
||||||
"relationship": newRelationship,
|
.relationship: newRelationship,
|
||||||
]
|
]
|
||||||
|
|
||||||
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
||||||
|
|
|
@ -23,7 +23,7 @@ extension DataSourceFacade {
|
||||||
)
|
)
|
||||||
|
|
||||||
let userInfo = [
|
let userInfo = [
|
||||||
"relationship": response.value,
|
.relationship: response.value,
|
||||||
]
|
]
|
||||||
|
|
||||||
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
||||||
|
|
|
@ -833,7 +833,7 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
|
||||||
|
|
||||||
// we need to trigger this here as domain block doesn't return a relationship
|
// we need to trigger this here as domain block doesn't return a relationship
|
||||||
let userInfo = [
|
let userInfo = [
|
||||||
"relationship": newRelationship,
|
.relationship: newRelationship,
|
||||||
]
|
]
|
||||||
|
|
||||||
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
NotificationCenter.default.post(name: .relationshipChanged, object: self, userInfo: userInfo)
|
||||||
|
@ -1002,7 +1002,7 @@ extension ProfileViewController {
|
||||||
@objc
|
@objc
|
||||||
func relationshipChanged(_ notification: Notification) {
|
func relationshipChanged(_ notification: Notification) {
|
||||||
|
|
||||||
guard let userInfo = notification.userInfo, let relationship = userInfo["relationship"] as? Mastodon.Entity.Relationship else {
|
guard let userInfo = notification.userInfo, let relationship = userInfo[.relationship] as? Mastodon.Entity.Relationship else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,8 @@ import CoreData
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
|
||||||
public extension Foundation.Notification.Name {
|
public extension Notification.Name {
|
||||||
static let userFetched = Notification.Name(rawValue: "org.joinmastodon.app.user-fetched")
|
static let userFetched = Notification.Name(rawValue: "org.joinmastodon.app.user-fetched")
|
||||||
static let relationshipChanged = Notification.Name(rawValue: "org.joinmastodon.app.relationship-changed")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension APIService {
|
extension APIService {
|
||||||
|
|
|
@ -11,6 +11,14 @@ import CoreData
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
|
||||||
|
extension Notification.Name {
|
||||||
|
public static let relationshipChanged = Notification.Name(rawValue: "org.joinmastodon.app.relationship-changed")
|
||||||
|
}
|
||||||
|
|
||||||
|
extension AnyHashable {
|
||||||
|
public static let relationship = "relationship"
|
||||||
|
}
|
||||||
|
|
||||||
extension APIService {
|
extension APIService {
|
||||||
public func relationship(
|
public func relationship(
|
||||||
forAccounts accounts: [Mastodon.Entity.Account],
|
forAccounts accounts: [Mastodon.Entity.Account],
|
||||||
|
|
Loading…
Reference in New Issue