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

feat(shorebird_code_push): add download update functionality #37

Merged
merged 7 commits into from
Jun 20, 2023

Conversation

bryanoltman
Copy link
Contributor

Description

Adds support for triggering patch download from a Flutter app.

Also adds logging for ffi errors to help point users in the correct direction when things aren't working as expected.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

# Conflicts:
#	shorebird_code_push/lib/src/shorebird_code_push.dart
#	shorebird_code_push/lib/src/updater.dart
#	shorebird_code_push/test/src/shorebird_code_push_test.dart
#	shorebird_code_push/test/src/updater_test.dart
@bryanoltman bryanoltman requested review from eseidel and felangel June 20, 2023 20:48
Comment on lines +84 to +85
await _shorebirdCodePush.downloadUpdate();
_nextPatchVersion = await _shorebirdCodePush.nextPatchNumber();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these ever throw? Should they be wrapped in a try/catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can these ever throw?

Not as it stands. If the underlying ffi code throws, we catch those errors and log them.

}

/// Downloads the latest patch, if available.
Future<void> downloadUpdate() async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to return a Stream of progress updates eventually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#38 :)

@bryanoltman bryanoltman requested a review from felangel June 20, 2023 20:58
@@ -2,48 +2,101 @@ import 'dart:isolate';

import 'package:shorebird_code_push/src/updater.dart';

/// A function that constructs an [Updater] instance. Used for testing.
typedef UpdaterBuilder = Updater Function();
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use @VisibleForTesting if you like, although that would add a package:meta dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already had the meta dependency, so I did that and also made a forTest constructor so UpdaterBuilder isn't part of the public API.

@bryanoltman bryanoltman merged commit 62ed676 into main Jun 20, 2023
@bryanoltman bryanoltman deleted the bo/download-update branch June 20, 2023 21:11
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