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

Parameterize the ApiConnection in getServerSettings. #103

Closed

Conversation

samwightt
Copy link

Parameterizes the ApiConnection in getServerSettings so that it can now be tested. Also fixes issue with SlottedContainerRenderObjectMixin, as it now requires two type parameters on Flutter main.

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @samwightt for the contribution!

See comments below. Before we can finish reviewing your main change, we'll need a revision that has a clean diff which doesn't make unrelated formatting changes.

The first commit, making an API update for a change in Flutter main, looks good. I'll merge it shortly with small stylistic tweaks.

Comment on lines 24 to +25
} finally {
connection.close();
apiConnection.close();
Copy link
Member

Choose a reason for hiding this comment

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

The responsibility for closing the connection should stay with the same code that's opening it. So when this function starts getting the ApiConnection from its caller, this part should move to the caller too.

For similar code to compare to, see the other API-endpoint bindings in other files of this lib/api/route/ directory.

@@ -16,15 +16,13 @@ part 'realm.g.dart';
// See thread, and the zulip-mobile code and chat thread it links to:
// https://github.com/zulip/zulip-flutter/pull/55#discussion_r1160267577
Future<GetServerSettingsResult> getServerSettings({
required Uri realmUrl,
required ApiConnection apiConnection,
Copy link
Member

Choose a reason for hiding this comment

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

This interface should align with the other functions in this directory that do a similar job of providing a binding to an API endpoint: a positional parameter named connection, rather than a named parameter named apiConnection.

Comment on lines -82 to +88
return ServerUrlParseResult.error(ServerUrlValidationError.unsupportedSchemeZulip);
} else if (url != null && url.hasScheme && url.scheme != 'http' && url.scheme != 'https') {
return ServerUrlParseResult.error(ServerUrlValidationError.unsupportedSchemeOther);
return ServerUrlParseResult.error(
ServerUrlValidationError.unsupportedSchemeZulip);
} else if (url != null &&
url.hasScheme &&
url.scheme != 'http' &&
url.scheme != 'https') {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this code wasn't something you intended to make changes to. So it should remain unchanged in this commit.

Like the Flutter repo itself, we don't use dartfmt.

Because there's a lot of this kind of change in this file, it's difficult to isolate the substantive changes in order to review those. So before we can finish reviewing this PR, you'll need to make a revision with a clean diff that doesn't make unrelated formatting changes.

with SlottedContainerRenderObjectMixin<StickyHeaderSlot> {
with SlottedContainerRenderObjectMixin<StickyHeaderSlot, RenderBox> {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this fix!

@gnprice
Copy link
Member

gnprice commented May 23, 2023

The first commit, making an API update for a change in Flutter main, looks good. I'll merge it shortly with small stylistic tweaks.

Done:
2f0f469 sticky_header: Pass new second type argument to SlottedContainerRenderObjectMixin et al.

gnprice added a commit to gnprice/zulip-flutter that referenced this pull request May 23, 2023
… class

This was introduced recently upstream, deprecating the old mixin
SlottedMultiChildRenderObjectWidgetMixin.

This change follows up on 2f0f469 (from zulip#103), which handled the
mandatory part of the same upstream API change.
@gnprice gnprice force-pushed the sw/parameterize-api-connection branch from 3d78afe to d79709a Compare May 23, 2023 00:53
chrisbobbe pushed a commit that referenced this pull request May 23, 2023
… class

This was introduced recently upstream, deprecating the old mixin
SlottedMultiChildRenderObjectWidgetMixin.

This change follows up on 2f0f469 (from #103), which handled the
mandatory part of the same upstream API change.
@gnprice
Copy link
Member

gnprice commented May 23, 2023

I've rebased this PR branch on top of the now-merged version of your first commit, just because there'd otherwise be a small merge conflict for you to resolve.

@samwightt
Copy link
Author

@gnprice Thanks for the feedback! Sorry, didn't realize there were so many formatting problems 😅 I'll take a look at this tomorrow and rebase + fix things :)

@gnprice
Copy link
Member

gnprice commented Aug 10, 2023

@samwightt Are you still planning to return to this PR? If not, no worries; just came across it in our queue.

@samwightt
Copy link
Author

@gnprice Agh sorry I'm not! Sorry about getting back to this so late.

@samwightt samwightt closed this Oct 19, 2023
@gnprice
Copy link
Member

gnprice commented Oct 20, 2023

No worries! Thanks for the update.

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.

None yet

2 participants