Skip to content

Make MeViewControllers observe changes to account - #4660

Merged
koke merged 20 commits into
developfrom
issue/me-observe-changes-to-profile
Jan 22, 2016
Merged

Make MeViewControllers observe changes to account#4660
koke merged 20 commits into
developfrom
issue/me-observe-changes-to-profile

Conversation

@koke

@koke koke commented Jan 12, 2016

Copy link
Copy Markdown
Member

This fix introduces RxSwift 2.1 and a new way to observe changes to the default account.
I think this could be made more generic allowing us to subscribe to changes to any specific managed object, but observing the default account was good enough for now.

Known Issues

The observables only support subscribing on the main thread. I've done some testing with subscribeOn, and values would sometimes be emitted on the right queue, but others would be forced on the main thread. I believe this is because the account changed notification is posted on the main thread, and RxCocoa's rx_notification, doesn't handle the thread switch well, but I'd have to dig more to figure our exactly what's going on.

Fixes #4416 and sets the scene for #4613

Needs Review: @sendhil

koke added 11 commits January 12, 2016 15:57
Otherwise, it wouldn't emit a value until some account property changed
We're already observing changes to the data model, no need for a second refresh
Instead of using a class property, make the observables instance properties so
we can inject the context of TestContextManager.
While writing unit tests, the previous code was failing.
I'm still not sure why, but it seemed more adequate to use the given objectID,
since it's a map function.
@koke koke added this to the 6.0 milestone Jan 14, 2016
@koke koke changed the title [WIP] Make MeViewControllers observe changes to account Make MeViewControllers observe changes to account Jan 14, 2016
koke added 3 commits January 14, 2016 16:59
This avoids some problems testing account change observers, since
dispatch_async doesn't play nice with XCTest asynchronous helpers
Rely only on RxSwift instead of notifications, as they are an implementation
detail that might change.

Since the problem with notifications is gone, moved the tests back to
AccountServiceTests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sendhil

sendhil commented Jan 22, 2016

Copy link
Copy Markdown
Contributor

:shipit:

koke added a commit that referenced this pull request Jan 22, 2016
…es-to-profile

Make MeViewControllers observe changes to account
@koke
koke merged commit 624e29b into develop Jan 22, 2016
@koke
koke deleted the issue/me-observe-changes-to-profile branch January 22, 2016 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avatar and user details not available right after sign in

2 participants