From 6edfb6eb785e84d012a477f60e2884647571a18a Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Fri, 7 Feb 2025 16:09:32 -0600 Subject: [PATCH] refactor(shorebird_code_push): upgrade analysis_options (#269) --- shorebird_code_push/analysis_options.yaml | 2 +- shorebird_code_push/lib/shorebird_code_push.dart | 3 --- shorebird_code_push/lib/src/shorebird_updater.dart | 2 ++ shorebird_code_push/lib/src/shorebird_updater_io.dart | 5 +++++ shorebird_code_push/pubspec.yaml | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/shorebird_code_push/analysis_options.yaml b/shorebird_code_push/analysis_options.yaml index 0f938e7..e60efac 100644 --- a/shorebird_code_push/analysis_options.yaml +++ b/shorebird_code_push/analysis_options.yaml @@ -1,4 +1,4 @@ -include: package:very_good_analysis/analysis_options.5.0.0.yaml +include: package:very_good_analysis/analysis_options.7.0.0.yaml analyzer: exclude: diff --git a/shorebird_code_push/lib/shorebird_code_push.dart b/shorebird_code_push/lib/shorebird_code_push.dart index b892eed..4ff1e1e 100644 --- a/shorebird_code_push/lib/shorebird_code_push.dart +++ b/shorebird_code_push/lib/shorebird_code_push.dart @@ -1,6 +1,3 @@ -/// Get info about your Shorebird code push app -library shorebird_code_push; - export 'src/shorebird_updater.dart' show Patch, diff --git a/shorebird_code_push/lib/src/shorebird_updater.dart b/shorebird_code_push/lib/src/shorebird_updater.dart index 790bc85..fb51494 100644 --- a/shorebird_code_push/lib/src/shorebird_updater.dart +++ b/shorebird_code_push/lib/src/shorebird_updater.dart @@ -54,6 +54,8 @@ class UpdateException implements Exception { /// Log message when the Shorebird updater is unavailable in the current /// environment. void logShorebirdEngineUnavailableMessage() { + // Printing to the console is intentional here since we want it to be obvious + // that the app is running in an environment where the updater is unavailable. // ignore: avoid_print print(''' ------------------------------------------------------------------------------- diff --git a/shorebird_code_push/lib/src/shorebird_updater_io.dart b/shorebird_code_push/lib/src/shorebird_updater_io.dart index 53f8655..ff8def4 100644 --- a/shorebird_code_push/lib/src/shorebird_updater_io.dart +++ b/shorebird_code_push/lib/src/shorebird_updater_io.dart @@ -31,6 +31,9 @@ class ShorebirdUpdaterImpl implements ShorebirdUpdater { // time the underlying Rust code could block getting the config lock. _updater.currentPatchNumber(); _isAvailable = true; + // We explicitly catch all errors and exceptions to ensure we notify users + // when the Shorebird Updater is unavailable. + // ignore: avoid_catches_without_on_clauses } catch (_) { logShorebirdEngineUnavailableMessage(); _isAvailable = false; @@ -91,6 +94,8 @@ class ShorebirdUpdaterImpl implements ShorebirdUpdater { try { result = await _run(() => _updater.update(track: track)); + // Explicitly catch all errors/exceptions to ensure we gracefully fallback. + // ignore: avoid_catches_without_on_clauses } catch (_) { return _legacyFallback(); } diff --git a/shorebird_code_push/pubspec.yaml b/shorebird_code_push/pubspec.yaml index 24b2e17..90e145d 100644 --- a/shorebird_code_push/pubspec.yaml +++ b/shorebird_code_push/pubspec.yaml @@ -16,7 +16,7 @@ dev_dependencies: ffigen: ">=8.0.2 <17.0.0" mocktail: ^1.0.0 test: ^1.19.2 - very_good_analysis: ">=6.0.0 <8.0.0" + very_good_analysis: ^7.0.0 ffigen: output: "lib/src/generated/updater_bindings.g.dart"