I just ran `cargo clippy -- -W clippy::pedantic` and fixed things.
These are more invasive that the default set and the remaining
warnings are mostly about our (abysmal) public docs missing
Error and Panic sections to explain errors and panicks.
* feat: report failure events to our servers
This doesn't tell us anything about the failure, just that it
happened. Which at least will let us communicate that to customers.
This currently has no tests and will need some before landing.
* Address review comments
* Use use statements for config and events
* Add partial test
* Add comment about when save happens
Refactored our PatchInstallEvent to be just PatchEvent
and allow us to have more than one event type.
I moved it into its own events.rs file and added privacy
warnings to both this and the network code (eventually
we may move all this into a separate privacy.rs file).
I also fixed our build.rs file to not panic when our build
is otherwise broken. For whatever reason that seems to
cause the rust-analyzer to stop and not show any future
warnings (thus it's hard to fix things).
I moved away from having a "new" method for PatchEvent
with a series of Strings (which could be confused in order)
and instead am now using just the normal default struct
construction which effectively has named args.
Since EventType is now an enum, it's easy to use the
right enum not have to call PatchInstallEvent::new to
get the right magic string for "identifier".
Also added a bit more documentation to c_api.rs
* break: move shorebird_code_push_io and _web into src/
Users were sometimes importing the _web version thinking it
was the "web safe" import, rather than shorebird_code_push.dart
and then being surprised when ShorebirdCodePush did nothing.
Fixes https://github.com/shorebirdtech/shorebird/issues/1209
* Update formating for Dart 3.1
* fix: use non-blocking http client when reporting launch success
* Make patch install report request on bg thread
* Pass client_id instead of state
* Convert client_id from &str to String
* feat: add client_id to UpdaterState
* feat: add support for reporting patch install events
* Ensure we save UpdaterState after it's created
* Save state if we assign it a client id on load
* Don't error in report_launch_success if no patch exists
* coverage
* Rename
* Minor refactor
* coverage
* coverage
* Update library/src/updater.rs
Co-authored-by: Felix Angelov <felix@shorebird.dev>
* restore debug logs
* make test serial
---------
Co-authored-by: Felix Angelov <felix@shorebird.dev>
* feat: add support for parsing auto_update from shorebird.yaml
The actual support will be in the C++ engine, but this keeps
all yaml parsing in the Rust code for simplicity.
---------
Co-authored-by: Felix Angelov <felix@shorebird.dev>
This is all for shorebirdtech/shorebird#695
I ended up fixing a lot of things in our Rust code while I was in there, including:
* Using PathBuf instead of Sting wherever we are holding onto Path objects (this removed a bunch of code which was converting in and out of these).
* Made a variety of functions private (the default) that were previously mistakenly pub.
* Moved the android hacks around libapp_paths closer to the C++ code. Previously we were storing all of the libapp_paths on ResolvedConfig and handling the android hacks during patch install. Now we're doing the android path hacks on init, eventually we'll remove them entirely by making the C++ code pass us in the android app_dir or even the resolved .apk we need instead of the libapp_paths.
* Fixed several tests to use /dir/lib/arch/libapp.so paths instead of 'libapp.so' now that the init code applies the android hacks an expects the deeper paths. Again, this will go away when we move the android hacks into c++.
* Added a test which confirms that if we init twice we log instead of trying to init again (this was one behavior which FCM was triggering as part of fix: ANR when using Firebase Cloud Messaging with Shorebird shorebird#695
* Add a test which confirms that further calls to update while an update is ongoing just fail out quickly instead of hanging.
* Moved to serial_test instead of a separate per-thread config system for testing. This makes our tests operate more like the code does in the wild, at the cost of needing to annotate a test as #[serial] any time it needs to use shorebird_init.
* Removed ResolvedConfig and now call it UpdateConfig. ResolvedConfig previously had a bool on it to tell if it was initialized, that's now represented as Option instead which is more rusty.
* Changed how we handle NetworkHooks from being compile-time test switched to using function pointers held off of UpdateConfig.network_hooks. I think this makes more sense? I did this to remove the special ThreadConfig object which was used during unit tests, but didn't exist in production. I think the way we mock networking could still be improved.
* feat: add shorebird_current_boot_patch_number function
* Continue support for next_patch_version
* rename, return null in case of 0
* feat(shorebird_code_push): add download update functionality
* rename defaultValue to fallbackValue
* add forTest constructor to ShorebirdCodePush
* feat(shorebird_code_push): add updater bindings and dart support
* newlines
* docs
* feat(shorebird_code_push): update example to use code push bindings
* Move checkForUpdate into setState
* Update to reflect patch number being sent as int
* polish
* updater test coverage
* Update shorebird_code_push/example/lib/main.dart
Co-authored-by: Felix Angelov <felix@shorebird.dev>
* Analysis
---------
Co-authored-by: Felix Angelov <felix@shorebird.dev>
* feat(shorebird_code_push): add updater bindings and dart support
* newlines
* docs
* Remove unused support for dart cli
* clarify Android-specific setup in readme