-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Better completion callback for activate #5646
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
Conversation
/// Completion handler invoked by activate method upon completion. | ||
/// @param changed Flag indicating whether or not the configuration changed. | ||
/// @param error Error message on failure. Nil if activation was successful. | ||
typedef void (^FIRRemoteConfigActivateChangeCompletion)(BOOL changed, NSError *_Nullable error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you illustrate a bit on what the advantage is. I'm guessing using the boolean as first parameter will improve checking in swift but I don't know what exactly it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gives feedback to the API client about whether or not the config changed without an error being thrown. See #3586 for more on the issues caused by the other API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, so this will align with Android.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And JS :)
805c9d0
to
eda90ad
Compare
XCTAssertEqual(status, RemoteConfigFetchStatus.success) | ||
self.config.activate { changed, error in | ||
XCTAssertNil(error) | ||
XCTAssert(changed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit: Can you change this to XCTAssertTrue
? I did a double take on it, I think explicitly saying True
makes it more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Done
@@ -59,6 +60,43 @@ class FakeConsoleTests: APITestBase { | |||
waitForExpectations() | |||
} | |||
|
|||
// Test New API. | |||
// Contrast with testUnchangedActivateWillFlag in APITests.swift. | |||
func testChangedActivateWillNotFlag() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also test the false, nil
case where activate is called but no changes happened?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that test doesn't need the FakeConsole and was added to APITests.swift
3b6e88b
to
58387fa
Compare
Adds an activate API with a changed parameter in the callback. It replaces a deprecated API that set an internal error if there was no change.
Fixes #3586
The integration test infrastructure is implemented in #5633
Googlers: See accompanying API proposal.