Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter_wkwebview] Return an NSNumber that represents a bool #5968

Merged
merged 4 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ - (void)testRemoveDataOfTypes {
blockError = error;
}];
XCTAssertEqualObjects(returnValue, @YES);
// Asserts whether the NSNumber will be deserialized by the standard codec as a boolean.
XCTAssertEqual(CFGetTypeID((__bridge CFTypeRef)(returnValue)), CFBooleanGetTypeID());
XCTAssertNil(blockError);
}
@end
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ - (void)createDefaultDataStoreWithIdentifier:(nonnull NSNumber *)identifier
modifiedSince:[NSDate dateWithTimeIntervalSince1970:
modificationTimeInSecondsSinceEpoch.doubleValue]
completionHandler:^{
completion(@(records.count > 0), nil);
completion([NSNumber numberWithBool:(records.count > 0)], nil);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, that's a surprising foot-gun. TIL.

What type was it turning into exactly? Int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, it was returning an int for some reason.

}];
}];
}
Expand Down