Skip to content

Commit e312fb8

Browse files
committed
Post account change notification from the main thread
1 parent bc3af0d commit e312fb8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Sources/WordPressData/Swift/WPAccount+RestApi.swift

+7-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,13 @@ extension WPAccount {
8484
//
8585
// The code path in which we are is that of an invalid token, and that's neither a login nor a logout, it's more appropriate to consider it a logout.
8686
// That's because if the token is invalid the app will soon received errors from the API and it's therefore better to force the user to login again.
87-
NotificationCenter.default.post(
88-
name: .wpAccountDefaultWordPressComAccountChanged,
89-
object: nil
90-
)
87+
88+
DispatchQueue.main.async {
89+
NotificationCenter.default.post(
90+
name: .wpAccountDefaultWordPressComAccountChanged,
91+
object: nil
92+
)
93+
}
9194
}
9295
}
9396
}

0 commit comments

Comments
 (0)