Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #68 #70

Merged
merged 4 commits into from
Jun 1, 2017
Merged

Fix #68 #70

merged 4 commits into from
Jun 1, 2017

Conversation

sebastianludwig
Copy link
Contributor

Fix by passing the Client object as Map.context instead of using objc_setAssociatedObject.

@loudmouth
Copy link
Contributor

Looks great!

One added side-effect of your change is that the Objective-C runtime is no longer necessary to build the SDK which opens up nice possibilities for building on Linux in the future. Would you be able to remove the import ObjectiveC.runtime LOC at Decoding.swift:11 and SignalUtils.swift:11?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 85.735% when pulling 72969f8 on sebastianludwig:master into 33afda4 on contentful:master.

@sebastianludwig
Copy link
Contributor Author

Sure thing. Unfortunately my fix wasn't complete, I forgot to transfer the context in SyncSpace.swift:195. I'll update the PR.

However, in the meantime: Is Client.space assigned anywhere and I'm just too blind to find it? My fix is still not working and that's because client.space is always nil...

@loudmouth
Copy link
Contributor

loudmouth commented Jun 1, 2017

wowzas. I can't believe I never noticed that space was not being assiged. Updating the fetchSpace method to the following should do the trick:

    @discardableResult public func fetchSpace(then completion: @escaping ResultsHandler<Space>) -> URLSessionDataTask? {
        if let space = self.space {
            completion(Result.success(space))
            return nil
        }
        return fetch(url: self.URL()) { [weak self] (result: Result<Space>) in
            self?.space = result.value
            completion(result)
        }
    }

@loudmouth
Copy link
Contributor

An added test asserting the the space is not nil on the client would be nice as well.

The Client object is passed as Map.context instead of using objc_setAssociatedObject. Also the locale resolution has been fixed.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 85.925% when pulling 01a28e2 on sebastianludwig:master into 33afda4 on contentful:master.

@sebastianludwig
Copy link
Contributor Author

I've spent ~8h debugging and fixing and stretched the consent of my project manager already quite a bit, so I've to leave the test implementation to the paid employee ;-)

It turned out that the default locale fallback was a bit of a mess, too. BTW, maybe the Defaults. should be writeable?

This patch applied on your 0.4.1 release is working for us now. We still got issues with the unreleased 0.5.0, but we're going to ignore that for now.

@loudmouth
Copy link
Contributor

Hey @sebastianludwig, it turns out locale handling was my next task even before your and your colleague opened these new issues yesterday and today.

I'm a bit confused as to how you'd like to proceed. Did you want to make the changes to the fetchSpace method and have this PR be merged? Or would you prefer that I work on top of your branch now. Either is fine for me.

@loudmouth loudmouth self-assigned this Jun 1, 2017
@sebastianludwig
Copy link
Contributor Author

Internally we're working with sebastianludwig/contentful.swift/fix-0.4.1 and are happy with that. The identical patch applies to your current master, so I made it the target for this PR. If you're happy with it (except for the missing unit tests), I'd say let's merge it and you can continue your regular work and don't have any lingering PRs.

If you also want to fix the 0.4.1 release and push a 0.4.2 we'd be happy to switch back to the official version (maybe with an accompanying contentful-persistence.swift release? ;-)).

Before we switch to 0.5.0 we need to muster up some more debugging motivation.

@loudmouth
Copy link
Contributor

Ok. If things are working on your end, I think it makes sense to merge this PR and then I'lll move forward with adding more tests and also continuing to improve logic around locales. I will also update contentful-persistence.swift as soon as the work on locales is done here and then ping you guys to do some testing. I think it will be too much work to fork a maintenance branch for the 0.4.x releases and cherry pick patches, and I'd prefer to work on the head of the project.

If it's alright with you, I'll be tagging you both you and @tapwork in the changelog for the next release.

Merging this PR will automatically close the referenced issue #68. Is that ok?

@loudmouth loudmouth merged commit f4a4f49 into contentful:master Jun 1, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 85.925% when pulling 68d8095 on sebastianludwig:master into 662cf64 on contentful:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants