Skip to content

Conversation

@CaseyHillers
Copy link
Contributor

@CaseyHillers CaseyHillers commented Mar 13, 2020

This adds the necessary backend in the Flutter app to get the list of branches from Cocoon. It defaults to showing just the master branch until data is loaded. The branch list is not refreshed after the initial load of the app.

Tests

Tested all possible points of error like the other cocoon service functions are.

Tested that on start of the Flutter build state this getFlutterBranches() is called.

Issues

flutter/flutter#51807 - Flutter branching for releases

Future Work

Enable UI in the Flutter app to switch the current branch

'An error occured fetching branches from flutter/flutter on Cocoon.';

/// Start a fixed interval loop that fetches build state updates based on [refreshRate].
Future<void> startFetchingBuildStateUpdates() async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: good to have a general function name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does startFetchingUpdates() SG?

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM.

Comment on lines 77 to +80
_fetchBuildStatusUpdate();

_fetchFlutterBranches()
.then((List<String> branchResponse) => _branches = branchResponse);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to use different refreshRate for these two functions? branch shall not be changed frequently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't use a timer or refresh for _fetchFlutterBranches. _fetchBuildStatusUpdate has a Timer.periodic does whereas the current implementation of _fetchFlutterBranches just requests the branches once at start of FlutterBuildState.

Copy link
Contributor

@keyonghan keyonghan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@digiter digiter left a comment

Choose a reason for hiding this comment

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

LGTM

final http.Response response = await _client.get(getBranchesUrl);

if (response.statusCode != HttpStatus.ok) {
print(response.body);
Copy link
Contributor

Choose a reason for hiding this comment

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

Intended to print? Why not use a logger?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIRC in the past we never integrated a logger service because it was (1) small detail during the EngRes project and (2) Flutter for web didn't necessarily have the plugin support for it. I believe both of these issues have been wiped away so I created flutter/flutter#52697 to track this.

@CaseyHillers CaseyHillers merged commit b739837 into flutter:master Mar 16, 2020
@CaseyHillers CaseyHillers deleted the branches branch March 16, 2020 22:40
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